답안 #647728

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
647728 2022-10-03T21:25:02 Z tvladm2009 송금 (JOI19_remittance) C++14
0 / 100
1 ms 340 KB
#include <iostream>

using namespace std;

int const nmax = 1000000;

int a[5 + nmax], b[5 + nmax];

int main() {
  std::ios_base::sync_with_stdio(0);
  std::cin.tie(0);

  int n;
  std::cin >> n;
  for(int i = 0;i < n; i++)
    std::cin >> a[i] >> b[i];

  while(true) {
    bool complete = true;
    for(int i = 0;i < n; i++) {
      if(a[i] > b[i]) {
        int aux = (a[i] - b[i] + 1) / 2;
        a[i] -= aux * 2;
        a[(i + 1) % n] += aux;
        if(aux > 0)
          complete = false;
      }
    }
    if(complete == true)
      break;
  }

  bool ans = false;
  for(int i = 0;i < n; i++) {
    if(b[i] > 0)
      ans = true;
  }
  for(int i = 0;i < n; i++) {
    if(a[i] != b[i])
      ans = false;
  }
  if(ans == true)
    std::cout << "Yes\n";
  else
    std::cout << "No\n";
  return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 0 ms 324 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 328 KB Output is correct
18 Correct 0 ms 340 KB Output is correct
19 Correct 0 ms 328 KB Output is correct
20 Correct 0 ms 340 KB Output is correct
21 Correct 1 ms 328 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 0 ms 324 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 324 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Incorrect 1 ms 332 KB Output isn't correct
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 0 ms 324 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 328 KB Output is correct
18 Correct 0 ms 340 KB Output is correct
19 Correct 0 ms 328 KB Output is correct
20 Correct 0 ms 340 KB Output is correct
21 Correct 1 ms 328 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 0 ms 324 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 324 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Incorrect 1 ms 332 KB Output isn't correct
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 328 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 0 ms 340 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 0 ms 340 KB Output is correct
12 Correct 1 ms 324 KB Output is correct
13 Correct 0 ms 324 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 328 KB Output is correct
18 Correct 0 ms 340 KB Output is correct
19 Correct 0 ms 328 KB Output is correct
20 Correct 0 ms 340 KB Output is correct
21 Correct 1 ms 328 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 0 ms 324 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 324 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Incorrect 1 ms 332 KB Output isn't correct
29 Halted 0 ms 0 KB -