# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1102142 | 2024-10-17T14:33:32 Z | ro9669 | 송금 (JOI19_remittance) | C++17 | 1 ms | 2612 KB |
#include <bits/stdc++.h> #define fi first #define se second #define all(v) v.begin() , v.end() #define sz(v) int(v.size()) #define unq(v) sort(all(v)); v.resize(unique(all(v)) - v.begin()); using namespace std; typedef long long ll; typedef pair<int , int> ii; typedef pair<long long , int> lli; const int maxN = int(1e6)+7; int n; ll a[maxN] , b[maxN]; void solve(){ cin >> n; for (int i = 0 ; i < n ; i++){ cin >> a[i] >> b[i]; } for (int t = 0 ; t < 100 ; t++){ for (int i = 0 ; i < n ; i++){ if (a[i] >= b[i]){ ll x = (a[i] - b[i]) / 2; a[i] -= 2 * x; a[(i + 1) % n] += x; } } } int cnt = 0; for (int i = 0 ; i < n ; i++){ cnt += (a[i] == b[i]); if (a[i] < b[i]){ cout << "No\n"; return; } } if (cnt == 0 || cnt == n) cout << "Yes\n"; else cout << "No\n"; } #define name "A" int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); if (fopen(name".INP" , "r")){ freopen(name".INP" , "r" , stdin); freopen(name".OUT" , "w" , stdout); } int t = 1; //cin >> t; while (t--) solve(); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2384 KB | Output is correct |
2 | Correct | 1 ms | 2384 KB | Output is correct |
3 | Correct | 1 ms | 2384 KB | Output is correct |
4 | Correct | 1 ms | 2384 KB | Output is correct |
5 | Correct | 1 ms | 2612 KB | Output is correct |
6 | Correct | 1 ms | 2384 KB | Output is correct |
7 | Correct | 1 ms | 2384 KB | Output is correct |
8 | Correct | 1 ms | 2384 KB | Output is correct |
9 | Correct | 1 ms | 2384 KB | Output is correct |
10 | Correct | 1 ms | 2384 KB | Output is correct |
11 | Correct | 1 ms | 2552 KB | Output is correct |
12 | Correct | 1 ms | 2384 KB | Output is correct |
13 | Correct | 1 ms | 2436 KB | Output is correct |
14 | Correct | 1 ms | 2400 KB | Output is correct |
15 | Correct | 1 ms | 2400 KB | Output is correct |
16 | Correct | 1 ms | 2396 KB | Output is correct |
17 | Correct | 1 ms | 2396 KB | Output is correct |
18 | Correct | 1 ms | 2400 KB | Output is correct |
19 | Correct | 1 ms | 2396 KB | Output is correct |
20 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
21 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2384 KB | Output is correct |
2 | Correct | 1 ms | 2384 KB | Output is correct |
3 | Correct | 1 ms | 2384 KB | Output is correct |
4 | Correct | 1 ms | 2384 KB | Output is correct |
5 | Correct | 1 ms | 2612 KB | Output is correct |
6 | Correct | 1 ms | 2384 KB | Output is correct |
7 | Correct | 1 ms | 2384 KB | Output is correct |
8 | Correct | 1 ms | 2384 KB | Output is correct |
9 | Correct | 1 ms | 2384 KB | Output is correct |
10 | Correct | 1 ms | 2384 KB | Output is correct |
11 | Correct | 1 ms | 2552 KB | Output is correct |
12 | Correct | 1 ms | 2384 KB | Output is correct |
13 | Correct | 1 ms | 2436 KB | Output is correct |
14 | Correct | 1 ms | 2400 KB | Output is correct |
15 | Correct | 1 ms | 2400 KB | Output is correct |
16 | Correct | 1 ms | 2396 KB | Output is correct |
17 | Correct | 1 ms | 2396 KB | Output is correct |
18 | Correct | 1 ms | 2400 KB | Output is correct |
19 | Correct | 1 ms | 2396 KB | Output is correct |
20 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
21 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 2384 KB | Output is correct |
2 | Correct | 1 ms | 2384 KB | Output is correct |
3 | Correct | 1 ms | 2384 KB | Output is correct |
4 | Correct | 1 ms | 2384 KB | Output is correct |
5 | Correct | 1 ms | 2612 KB | Output is correct |
6 | Correct | 1 ms | 2384 KB | Output is correct |
7 | Correct | 1 ms | 2384 KB | Output is correct |
8 | Correct | 1 ms | 2384 KB | Output is correct |
9 | Correct | 1 ms | 2384 KB | Output is correct |
10 | Correct | 1 ms | 2384 KB | Output is correct |
11 | Correct | 1 ms | 2552 KB | Output is correct |
12 | Correct | 1 ms | 2384 KB | Output is correct |
13 | Correct | 1 ms | 2436 KB | Output is correct |
14 | Correct | 1 ms | 2400 KB | Output is correct |
15 | Correct | 1 ms | 2400 KB | Output is correct |
16 | Correct | 1 ms | 2396 KB | Output is correct |
17 | Correct | 1 ms | 2396 KB | Output is correct |
18 | Correct | 1 ms | 2400 KB | Output is correct |
19 | Correct | 1 ms | 2396 KB | Output is correct |
20 | Incorrect | 1 ms | 2396 KB | Output isn't correct |
21 | Halted | 0 ms | 0 KB | - |