답안 #441214

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
441214 2021-07-04T16:59:16 Z peijar 송금 (JOI19_remittance) C++17
0 / 100
1 ms 316 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

signed main(void) {
  ios_base::sync_with_stdio(false);
  cin.tie(0);

  int N;
  cin >> N;
  vector<int> A(N), B(N);
  for (int i = 0; i < N; ++i) {
    cin >> A[i] >> B[i];
  }
  long double fdelta1 = A[0] - B[0];
  long double pow2 = 1 / 4.;
  for (int i = N - 1; i > 0; --i, pow2 /= 2.)
    fdelta1 += (A[i] - B[i]) * pow2;
  vector<int> delta(N);
  delta[0] = roundl(fdelta1);
  for (int i = 1; i < N; ++i) {
    delta[i] = (A[i] - B[i] + delta[i - 1]) / 2;
  }
  for (int i = 0; i < N; ++i) {
    if (delta[i] < 0 or
        A[i] - 2 * delta[i] + delta[i ? i - 1 : N - 1] != B[i]) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Incorrect 0 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Incorrect 0 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Incorrect 0 ms 204 KB Output isn't correct
5 Halted 0 ms 0 KB -