답안 #225403

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
225403 2020-04-20T13:45:00 Z MKopchev 송금 (JOI19_remittance) C++14
100 / 100
430 ms 28664 KB
#include<bits/stdc++.h>
using namespace std;
const int nmax=1e6+42;

int n;

int inp[nmax],outp[nmax];

void print(int ok)
{
    if(ok)printf("Yes\n");
    else printf("No\n");
    exit(0);
}
int main()
{
    scanf("%i",&n);

    int mx_a=0,mx_b=0;

    for(int i=1;i<=n;i++)
    {
        scanf("%i%i",&inp[i],&outp[i]);
        mx_a=max(mx_a,inp[i]);
        mx_b=max(mx_b,outp[i]);
    }

    if(mx_b==0)
    {
        if(mx_a==0)print(1);
        print(0);
    }

    for(int step=1;step<=50;step++)
        for(int i=1;i<=n;i++)
        {
            int nxt=i+1;
            if(nxt>n)nxt=nxt-n;

            if(inp[i]>outp[i])
            {
                int send=(inp[i]-outp[i]+1)/2;

                inp[i]=inp[i]-2*send;
                inp[nxt]=inp[nxt]+send;
            }
        }


    for(int i=1;i<=n;i++)
        if(inp[i]!=outp[i])print(0);
    print(1);
    return 0;
}

Compilation message

remittance.cpp: In function 'int main()':
remittance.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%i",&n);
     ~~~~~^~~~~~~~~
remittance.cpp:23:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%i%i",&inp[i],&outp[i]);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 4 ms 376 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 4 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 4 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 4 ms 384 KB Output is correct
27 Correct 4 ms 384 KB Output is correct
28 Correct 4 ms 384 KB Output is correct
29 Correct 5 ms 256 KB Output is correct
30 Correct 5 ms 256 KB Output is correct
31 Correct 5 ms 384 KB Output is correct
32 Correct 4 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 4 ms 376 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 4 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 4 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 4 ms 384 KB Output is correct
27 Correct 4 ms 384 KB Output is correct
28 Correct 4 ms 384 KB Output is correct
29 Correct 5 ms 256 KB Output is correct
30 Correct 5 ms 256 KB Output is correct
31 Correct 5 ms 384 KB Output is correct
32 Correct 4 ms 384 KB Output is correct
33 Correct 4 ms 384 KB Output is correct
34 Correct 5 ms 384 KB Output is correct
35 Correct 5 ms 384 KB Output is correct
36 Correct 4 ms 384 KB Output is correct
37 Correct 5 ms 256 KB Output is correct
38 Correct 5 ms 384 KB Output is correct
39 Correct 4 ms 384 KB Output is correct
40 Correct 4 ms 384 KB Output is correct
41 Correct 6 ms 384 KB Output is correct
42 Correct 5 ms 384 KB Output is correct
43 Correct 5 ms 384 KB Output is correct
44 Correct 4 ms 384 KB Output is correct
45 Correct 5 ms 416 KB Output is correct
46 Correct 4 ms 384 KB Output is correct
47 Correct 5 ms 384 KB Output is correct
48 Correct 5 ms 384 KB Output is correct
49 Correct 5 ms 384 KB Output is correct
50 Correct 5 ms 384 KB Output is correct
51 Correct 4 ms 384 KB Output is correct
52 Correct 4 ms 384 KB Output is correct
53 Correct 5 ms 384 KB Output is correct
54 Correct 4 ms 384 KB Output is correct
55 Correct 5 ms 384 KB Output is correct
56 Correct 5 ms 384 KB Output is correct
57 Correct 4 ms 384 KB Output is correct
58 Correct 4 ms 384 KB Output is correct
59 Correct 5 ms 384 KB Output is correct
60 Correct 4 ms 256 KB Output is correct
61 Correct 5 ms 384 KB Output is correct
62 Correct 4 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 4 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 4 ms 376 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 384 KB Output is correct
22 Correct 4 ms 384 KB Output is correct
23 Correct 5 ms 384 KB Output is correct
24 Correct 4 ms 384 KB Output is correct
25 Correct 5 ms 384 KB Output is correct
26 Correct 4 ms 384 KB Output is correct
27 Correct 4 ms 384 KB Output is correct
28 Correct 4 ms 384 KB Output is correct
29 Correct 5 ms 256 KB Output is correct
30 Correct 5 ms 256 KB Output is correct
31 Correct 5 ms 384 KB Output is correct
32 Correct 4 ms 384 KB Output is correct
33 Correct 4 ms 384 KB Output is correct
34 Correct 5 ms 384 KB Output is correct
35 Correct 5 ms 384 KB Output is correct
36 Correct 4 ms 384 KB Output is correct
37 Correct 5 ms 256 KB Output is correct
38 Correct 5 ms 384 KB Output is correct
39 Correct 4 ms 384 KB Output is correct
40 Correct 4 ms 384 KB Output is correct
41 Correct 6 ms 384 KB Output is correct
42 Correct 5 ms 384 KB Output is correct
43 Correct 5 ms 384 KB Output is correct
44 Correct 4 ms 384 KB Output is correct
45 Correct 5 ms 416 KB Output is correct
46 Correct 4 ms 384 KB Output is correct
47 Correct 5 ms 384 KB Output is correct
48 Correct 5 ms 384 KB Output is correct
49 Correct 5 ms 384 KB Output is correct
50 Correct 5 ms 384 KB Output is correct
51 Correct 4 ms 384 KB Output is correct
52 Correct 4 ms 384 KB Output is correct
53 Correct 5 ms 384 KB Output is correct
54 Correct 4 ms 384 KB Output is correct
55 Correct 5 ms 384 KB Output is correct
56 Correct 5 ms 384 KB Output is correct
57 Correct 4 ms 384 KB Output is correct
58 Correct 4 ms 384 KB Output is correct
59 Correct 5 ms 384 KB Output is correct
60 Correct 4 ms 256 KB Output is correct
61 Correct 5 ms 384 KB Output is correct
62 Correct 4 ms 384 KB Output is correct
63 Correct 430 ms 27512 KB Output is correct
64 Correct 236 ms 12024 KB Output is correct
65 Correct 425 ms 27256 KB Output is correct
66 Correct 251 ms 12024 KB Output is correct
67 Correct 256 ms 13688 KB Output is correct
68 Correct 274 ms 15864 KB Output is correct
69 Correct 427 ms 27640 KB Output is correct
70 Correct 235 ms 12152 KB Output is correct
71 Correct 262 ms 13432 KB Output is correct
72 Correct 285 ms 15864 KB Output is correct
73 Correct 422 ms 27512 KB Output is correct
74 Correct 233 ms 12152 KB Output is correct
75 Correct 254 ms 13432 KB Output is correct
76 Correct 280 ms 15992 KB Output is correct
77 Correct 422 ms 27560 KB Output is correct
78 Correct 247 ms 19828 KB Output is correct
79 Correct 246 ms 19832 KB Output is correct
80 Correct 314 ms 19856 KB Output is correct
81 Correct 324 ms 19832 KB Output is correct
82 Correct 148 ms 12024 KB Output is correct
83 Correct 222 ms 12024 KB Output is correct
84 Correct 178 ms 12152 KB Output is correct
85 Correct 381 ms 28652 KB Output is correct
86 Correct 388 ms 28664 KB Output is correct
87 Correct 205 ms 20852 KB Output is correct
88 Correct 275 ms 20856 KB Output is correct