답안 #197629

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
197629 2020-01-22T04:44:46 Z IOrtroiii 송금 (JOI19_remittance) C++14
0 / 100
2 ms 380 KB
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

int main() {
   ios_base::sync_with_stdio(false);
   int N;
   cin >> N;
   vector<ll> A(N), B(N);
   for (int i = 0; i < N; ++i) {
      cin >> A[i] >> B[i];
   }
   while (true) {
      bool changed = false;
      for (int i = 0; i < N; ++i) {
         int j = (i + 1) % N;
         if (A[i] - B[i] >= 2) {
            ll z = (A[i] - B[i]) / 2;
            A[i] -= 2 * z;
            A[j] += z;
            changed = true;
         }
      }
      if (!changed) break;
   }
   for (int i = 0; i < N; ++i) if (A[i] ^ B[i]) return cout << "No\n",0;
   return cout << "Yes\n",0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 380 KB Output is correct
8 Incorrect 2 ms 376 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 380 KB Output is correct
8 Incorrect 2 ms 376 KB Output isn't correct
9 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 380 KB Output is correct
8 Incorrect 2 ms 376 KB Output isn't correct
9 Halted 0 ms 0 KB -