답안 #519552

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
519552 2022-01-26T16:21:29 Z cig32 송금 (JOI19_remittance) C++17
15 / 100
539 ms 324 KB
#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
using namespace std;
mt19937_64 rng((int)std::chrono::steady_clock::now().time_since_epoch().count());
const int MAXN = 3e5 + 10;
const int MOD = 1e9 + 7;
#define int long long
int rnd(int x, int y) {
  int u = uniform_int_distribution<int>(x, y)(rng); return u;
}
void solve(int tc) {
  int n; cin >> n;
  vector<int> a(n), b(n);
  for(int i=0; i<n; i++) cin >> a[i] >> b[i];
  for(int i=0; i<2e7; i++) {
    for(int j=0; j<n; j++) {
      if(a[j] > b[j]) {
        if(a[j] >= 2) {
          a[j] -= 2;
          a[(j+1) % n]++;
        }
      }
    }
  }
  for(int i=0; i<n; i++) {
    if(a[i] != b[i]) {
      cout << "No\n"; return;
    }
  }
  cout << "Yes\n";
}
 
int32_t main(){
  ios::sync_with_stdio(0); cin.tie(0);
  int t = 1; //cin >> t;
  for(int i=1; i<=t; i++) solve(i);
} 
# 결과 실행 시간 메모리 Grader output
1 Correct 121 ms 308 KB Output is correct
2 Correct 53 ms 296 KB Output is correct
3 Correct 52 ms 296 KB Output is correct
4 Correct 67 ms 204 KB Output is correct
5 Correct 89 ms 296 KB Output is correct
6 Correct 116 ms 296 KB Output is correct
7 Correct 124 ms 204 KB Output is correct
8 Correct 58 ms 296 KB Output is correct
9 Correct 74 ms 204 KB Output is correct
10 Correct 107 ms 204 KB Output is correct
11 Correct 128 ms 204 KB Output is correct
12 Correct 56 ms 204 KB Output is correct
13 Correct 80 ms 204 KB Output is correct
14 Correct 112 ms 312 KB Output is correct
15 Correct 125 ms 204 KB Output is correct
16 Correct 52 ms 204 KB Output is correct
17 Correct 72 ms 300 KB Output is correct
18 Correct 100 ms 204 KB Output is correct
19 Correct 111 ms 204 KB Output is correct
20 Correct 116 ms 308 KB Output is correct
21 Correct 123 ms 300 KB Output is correct
22 Correct 123 ms 292 KB Output is correct
23 Correct 124 ms 296 KB Output is correct
24 Correct 118 ms 204 KB Output is correct
25 Correct 111 ms 296 KB Output is correct
26 Correct 157 ms 292 KB Output is correct
27 Correct 117 ms 296 KB Output is correct
28 Correct 112 ms 204 KB Output is correct
29 Correct 114 ms 292 KB Output is correct
30 Correct 121 ms 296 KB Output is correct
31 Correct 118 ms 292 KB Output is correct
32 Correct 116 ms 296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 121 ms 308 KB Output is correct
2 Correct 53 ms 296 KB Output is correct
3 Correct 52 ms 296 KB Output is correct
4 Correct 67 ms 204 KB Output is correct
5 Correct 89 ms 296 KB Output is correct
6 Correct 116 ms 296 KB Output is correct
7 Correct 124 ms 204 KB Output is correct
8 Correct 58 ms 296 KB Output is correct
9 Correct 74 ms 204 KB Output is correct
10 Correct 107 ms 204 KB Output is correct
11 Correct 128 ms 204 KB Output is correct
12 Correct 56 ms 204 KB Output is correct
13 Correct 80 ms 204 KB Output is correct
14 Correct 112 ms 312 KB Output is correct
15 Correct 125 ms 204 KB Output is correct
16 Correct 52 ms 204 KB Output is correct
17 Correct 72 ms 300 KB Output is correct
18 Correct 100 ms 204 KB Output is correct
19 Correct 111 ms 204 KB Output is correct
20 Correct 116 ms 308 KB Output is correct
21 Correct 123 ms 300 KB Output is correct
22 Correct 123 ms 292 KB Output is correct
23 Correct 124 ms 296 KB Output is correct
24 Correct 118 ms 204 KB Output is correct
25 Correct 111 ms 296 KB Output is correct
26 Correct 157 ms 292 KB Output is correct
27 Correct 117 ms 296 KB Output is correct
28 Correct 112 ms 204 KB Output is correct
29 Correct 114 ms 292 KB Output is correct
30 Correct 121 ms 296 KB Output is correct
31 Correct 118 ms 292 KB Output is correct
32 Correct 116 ms 296 KB Output is correct
33 Correct 539 ms 292 KB Output is correct
34 Correct 292 ms 324 KB Output is correct
35 Correct 289 ms 204 KB Output is correct
36 Incorrect 182 ms 296 KB Output isn't correct
37 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 121 ms 308 KB Output is correct
2 Correct 53 ms 296 KB Output is correct
3 Correct 52 ms 296 KB Output is correct
4 Correct 67 ms 204 KB Output is correct
5 Correct 89 ms 296 KB Output is correct
6 Correct 116 ms 296 KB Output is correct
7 Correct 124 ms 204 KB Output is correct
8 Correct 58 ms 296 KB Output is correct
9 Correct 74 ms 204 KB Output is correct
10 Correct 107 ms 204 KB Output is correct
11 Correct 128 ms 204 KB Output is correct
12 Correct 56 ms 204 KB Output is correct
13 Correct 80 ms 204 KB Output is correct
14 Correct 112 ms 312 KB Output is correct
15 Correct 125 ms 204 KB Output is correct
16 Correct 52 ms 204 KB Output is correct
17 Correct 72 ms 300 KB Output is correct
18 Correct 100 ms 204 KB Output is correct
19 Correct 111 ms 204 KB Output is correct
20 Correct 116 ms 308 KB Output is correct
21 Correct 123 ms 300 KB Output is correct
22 Correct 123 ms 292 KB Output is correct
23 Correct 124 ms 296 KB Output is correct
24 Correct 118 ms 204 KB Output is correct
25 Correct 111 ms 296 KB Output is correct
26 Correct 157 ms 292 KB Output is correct
27 Correct 117 ms 296 KB Output is correct
28 Correct 112 ms 204 KB Output is correct
29 Correct 114 ms 292 KB Output is correct
30 Correct 121 ms 296 KB Output is correct
31 Correct 118 ms 292 KB Output is correct
32 Correct 116 ms 296 KB Output is correct
33 Correct 539 ms 292 KB Output is correct
34 Correct 292 ms 324 KB Output is correct
35 Correct 289 ms 204 KB Output is correct
36 Incorrect 182 ms 296 KB Output isn't correct
37 Halted 0 ms 0 KB -