답안 #468075

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
468075 2021-08-26T12:51:20 Z stefantaga 송금 (JOI19_remittance) C++14
100 / 100
301 ms 36408 KB
#include <cstdio>
#include <vector>
using namespace std;

int main()
{
  int n;
  scanf("%d",&n);
  vector<long long> A(n),B(n);
  for(int i=0;i<n;i++){
    scanf("%lld%lld",&A[i],&B[i]);
  }
  bool F,G=false;
  for(int i=0;i<n;i++){
    G|=(B[i]>0);
  }
  if(!G){
    F=true;
    for(int i=0;i<n;i++){
      F&=(A[i]==0);
    }
  }
  else{
    bool loop=true;
    while(loop){
      loop=false;
      for(int i=0;i<n;i++){
	if(A[i]>B[i]){
	  long long t=(A[i]-B[i]+1)/2;
	  A[i]-=2*t;
	  A[(i+1)%n]+=t;
	  loop=true;
	}
      }
    }
    F=true;
    for(int i=0;i<n;i++){
      F&=(A[i]==B[i]);
    }
  }
  puts(F?"Yes":"No");
  return 0;
}

Compilation message

remittance.cpp: In function 'int main()':
remittance.cpp:8:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |   scanf("%d",&n);
      |   ~~~~~^~~~~~~~~
remittance.cpp:11:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |     scanf("%lld%lld",&A[i],&B[i]);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 280 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 284 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 284 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 0 ms 204 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
26 Correct 0 ms 204 KB Output is correct
27 Correct 0 ms 204 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 0 ms 204 KB Output is correct
30 Correct 0 ms 204 KB Output is correct
31 Correct 0 ms 204 KB Output is correct
32 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 280 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 284 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 284 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 0 ms 204 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
26 Correct 0 ms 204 KB Output is correct
27 Correct 0 ms 204 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 0 ms 204 KB Output is correct
30 Correct 0 ms 204 KB Output is correct
31 Correct 0 ms 204 KB Output is correct
32 Correct 0 ms 204 KB Output is correct
33 Correct 1 ms 204 KB Output is correct
34 Correct 0 ms 204 KB Output is correct
35 Correct 0 ms 204 KB Output is correct
36 Correct 0 ms 204 KB Output is correct
37 Correct 0 ms 204 KB Output is correct
38 Correct 0 ms 204 KB Output is correct
39 Correct 0 ms 204 KB Output is correct
40 Correct 0 ms 204 KB Output is correct
41 Correct 0 ms 204 KB Output is correct
42 Correct 0 ms 204 KB Output is correct
43 Correct 0 ms 204 KB Output is correct
44 Correct 1 ms 284 KB Output is correct
45 Correct 0 ms 204 KB Output is correct
46 Correct 0 ms 204 KB Output is correct
47 Correct 0 ms 204 KB Output is correct
48 Correct 1 ms 204 KB Output is correct
49 Correct 0 ms 204 KB Output is correct
50 Correct 0 ms 204 KB Output is correct
51 Correct 0 ms 204 KB Output is correct
52 Correct 0 ms 204 KB Output is correct
53 Correct 0 ms 204 KB Output is correct
54 Correct 0 ms 204 KB Output is correct
55 Correct 0 ms 288 KB Output is correct
56 Correct 0 ms 204 KB Output is correct
57 Correct 0 ms 204 KB Output is correct
58 Correct 1 ms 280 KB Output is correct
59 Correct 0 ms 204 KB Output is correct
60 Correct 0 ms 204 KB Output is correct
61 Correct 0 ms 204 KB Output is correct
62 Correct 1 ms 284 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 280 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 1 ms 284 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 284 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 0 ms 204 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
26 Correct 0 ms 204 KB Output is correct
27 Correct 0 ms 204 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
29 Correct 0 ms 204 KB Output is correct
30 Correct 0 ms 204 KB Output is correct
31 Correct 0 ms 204 KB Output is correct
32 Correct 0 ms 204 KB Output is correct
33 Correct 1 ms 204 KB Output is correct
34 Correct 0 ms 204 KB Output is correct
35 Correct 0 ms 204 KB Output is correct
36 Correct 0 ms 204 KB Output is correct
37 Correct 0 ms 204 KB Output is correct
38 Correct 0 ms 204 KB Output is correct
39 Correct 0 ms 204 KB Output is correct
40 Correct 0 ms 204 KB Output is correct
41 Correct 0 ms 204 KB Output is correct
42 Correct 0 ms 204 KB Output is correct
43 Correct 0 ms 204 KB Output is correct
44 Correct 1 ms 284 KB Output is correct
45 Correct 0 ms 204 KB Output is correct
46 Correct 0 ms 204 KB Output is correct
47 Correct 0 ms 204 KB Output is correct
48 Correct 1 ms 204 KB Output is correct
49 Correct 0 ms 204 KB Output is correct
50 Correct 0 ms 204 KB Output is correct
51 Correct 0 ms 204 KB Output is correct
52 Correct 0 ms 204 KB Output is correct
53 Correct 0 ms 204 KB Output is correct
54 Correct 0 ms 204 KB Output is correct
55 Correct 0 ms 288 KB Output is correct
56 Correct 0 ms 204 KB Output is correct
57 Correct 0 ms 204 KB Output is correct
58 Correct 1 ms 280 KB Output is correct
59 Correct 0 ms 204 KB Output is correct
60 Correct 0 ms 204 KB Output is correct
61 Correct 0 ms 204 KB Output is correct
62 Correct 1 ms 284 KB Output is correct
63 Correct 301 ms 35252 KB Output is correct
64 Correct 200 ms 19736 KB Output is correct
65 Correct 290 ms 34884 KB Output is correct
66 Correct 198 ms 19772 KB Output is correct
67 Correct 196 ms 21188 KB Output is correct
68 Correct 214 ms 23744 KB Output is correct
69 Correct 280 ms 35384 KB Output is correct
70 Correct 203 ms 19764 KB Output is correct
71 Correct 199 ms 21172 KB Output is correct
72 Correct 208 ms 23648 KB Output is correct
73 Correct 285 ms 35268 KB Output is correct
74 Correct 201 ms 19772 KB Output is correct
75 Correct 200 ms 21176 KB Output is correct
76 Correct 207 ms 23600 KB Output is correct
77 Correct 278 ms 35248 KB Output is correct
78 Correct 215 ms 27576 KB Output is correct
79 Correct 222 ms 27448 KB Output is correct
80 Correct 215 ms 27564 KB Output is correct
81 Correct 220 ms 27452 KB Output is correct
82 Correct 165 ms 19772 KB Output is correct
83 Correct 170 ms 19764 KB Output is correct
84 Correct 202 ms 19896 KB Output is correct
85 Correct 279 ms 36408 KB Output is correct
86 Correct 276 ms 36384 KB Output is correct
87 Correct 222 ms 28856 KB Output is correct
88 Correct 230 ms 28604 KB Output is correct