Link. There is a nice approach to this problem that involves some physical insight. In the following we'll refer to Takahashi as A and to Aoki as B. Without loss of generality, assume $A_1 > B_1$. Consider A's relative motion with respect to B, i.e.…
[AtCoder] NIKKEI Programming Contest 2019   本来看见这一场的排名的画风比较正常就来补一下题,但是完全没有发现后两题的AC人数远少于我补的上一份AtCoder. A - Subscribers   首先始终 \(max = \min(A, B)\) ,\(min\) 的话如果 \(A + B \leq N\) ,那么就是 \(0\) ,否则就是 \(A + B - N\) . int n, a, b; int main() { read(n), read…
题目分析在代码注释里. int main() { #if defined LOCAL && !defined DUIPAI ifstream in("main.in"); cin.rdbuf(in.rdbuf()); // ofstream out("main.out"); // cout.rdbuf(out.rdbuf()); #endif int n, q; scan(n, q); vi a(n); scan(a); vl sum(n); sum…
[AtCoder] Yahoo Programming Contest 2019   很遗憾错过了一场 AtCoder .听说这场是涨分场呢,于是特意来补一下题. A - Anti-Adjacency   显然 \(K \leq \frac{N + 1}2\) int n, k; int main() { #ifdef hzhkk freopen("hkk.in", "r", stdin); #endif read(n), read(k); if (k <=…
Problem F Funny Car Racing There is a funny car racing in a city with n junctions and m directed roads. The funny part is: each road is open and closed periodically. Each road is associate with two integers (a, b), that means the road will be open fo…
题目链接:https://nikkei2019-qual.contest.atcoder.jp/tasks/nikkei2019_qual_C 题意:给出 n 种食物,Takahashi 吃下获得 ai 快乐值,Aoki 吃下获得 bi 快乐值,两人轮流吃,他们的目标是最大化自己获得的快乐值减去她人获得的快乐值吗,问最后该值是多少. 题解:易知 Takahashi 要最大化答案而 Aoki 要最小化答案,考虑全部食物由 Aoki 吃下,则ans = -(b1 + b2 + .... + bn),…
链接: https://codeforces.com/gym/102394/problem/F 题意: Harbin, whose name was originally a Manchu word meaning "a place for drying fishing nets", grew from a small rural settlement on the Songhua River to become one of the largest cities in Northea…
1.A题 题意:给定第一行的值表示m列的最大值,第m行的值表示n行的最大值,问是否会行列冲突 思路:挺简单的,不过我在一开始理解题意上用了些时间,按我的理解是输入两组数组,找出每组最大数,若相等则输出possible,否则输出impossible,代码很直接用的C语言 1 #include<stdio.h> 2 int main(){ 3 int r,c,i,j; 4 int s[110],b[110]; 5 while(scanf("%d %d",&r,&…
A:签到. #include<iostream> #include<cstdio> #include<cmath> #include<cstdlib> #include<cstring> #include<algorithm> using namespace std; #define ll long long char getc(){char c=getchar();while ((c<'A'||c>'Z')&&a…
A:签到. #include<iostream> #include<cstdio> #include<cstdlib> #include<cstring> #include<cmath> #include<algorithm> using namespace std; int gcd(int n,int m){return m==0?n:gcd(m,n%m);} int read() { int x=0,f=1;char c=getc…