Submission #27050643
Source Code Expand
#define min(p,q)((p)<(q)?(p):(q))
void solve(){
long long hito[6],nimotsu[6];
for(int i=1;i<=5;i++)scanf("%lld",nimotsu+i);
for(int i=1;i<=5;i++)scanf("%lld",hito+i);
for(int i=5;i>=1;i--){
long long x=min(nimotsu[i],hito[i]);
nimotsu[i]-=x;
hito[i]-=x;
for(int j=5;j>=i;j--){
x=min(nimotsu[i],hito[j]);
nimotsu[i]-=x;
hito[j]-=x;
hito[j-i]+=x;
}
}
puts(nimotsu[1]||nimotsu[2]||nimotsu[3]||nimotsu[4]||nimotsu[5]?"No":"Yes");
}
int main(){
int t;
scanf("%d",&t);
while(t--)solve();
}
Submission Info
| Submission Time | |
|---|---|
| Task | G - The baggage |
| User | kyopro_friends |
| Language | C (GCC 9.2.1) |
| Score | 600 |
| Code Size | 540 Byte |
| Status | AC |
| Exec Time | 81 ms |
| Memory | 1660 KiB |
Compile Error
./Main.c: In function ‘solve’:
./Main.c:5:23: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
5 | for(int i=1;i<=5;i++)scanf("%lld",nimotsu+i);
| ^~~~~
./Main.c:5:23: warning: incompatible implicit declaration of built-in function ‘scanf’
./Main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
+++ |+#include <stdio.h>
1 | #define min(p,q)((p)<(q)?(p):(q))
./Main.c:6:23: warning: incompatible implicit declaration of built-in function ‘scanf’
6 | for(int i=1;i<=5;i++)scanf("%lld",hito+i);
| ^~~~~
./Main.c:6:23: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
./Main.c:18:2: warning: implicit declaration of function ‘puts’ [-Wimplicit-function-declaration]
18 | puts(nimotsu[1]||nimotsu[2]||nimotsu[3]||nimotsu[4]||nimotsu[5]?"No":"Yes");
| ^~~~
./Main.c: In function ‘main’:
./Main.c:23:2: warning: incompatible implicit declaration of built-in function ‘scanf’
23 | scanf("%d",&t);
| ^~~~~
./Main.c:23:2: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 600 / 600 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | example_00.txt |
| All | example_00.txt, hand_00.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, shuffle_00.txt, shuffle_01.txt, shuffle_02.txt, shuffle_03.txt, shuffle_04.txt, shuffle_05.txt, shuffle_06.txt, shuffle_07.txt, shuffle_08.txt, shuffle_09.txt, shuffle_10.txt, shuffle_11.txt, shuffle_12.txt, shuffle_13.txt, shuffle_14.txt, shuffle_15.txt, shuffle_16.txt, shuffle_17.txt, shuffle_18.txt, shuffle_19.txt, shuffle_20.txt, shuffle_21.txt, shuffle_22.txt, shuffle_23.txt, shuffle_24.txt, shuffle_25.txt, shuffle_26.txt, shuffle_27.txt, shuffle_28.txt, shuffle_29.txt, shuffle_30.txt, shuffle_31.txt, shuffle_32.txt, shuffle_33.txt, shuffle_34.txt, shuffle_35.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| example_00.txt | AC | 2 ms | 1660 KiB |
| hand_00.txt | AC | 81 ms | 1604 KiB |
| random_00.txt | AC | 76 ms | 1508 KiB |
| random_01.txt | AC | 79 ms | 1612 KiB |
| random_02.txt | AC | 72 ms | 1508 KiB |
| random_03.txt | AC | 76 ms | 1620 KiB |
| random_04.txt | AC | 79 ms | 1592 KiB |
| random_05.txt | AC | 80 ms | 1600 KiB |
| random_06.txt | AC | 76 ms | 1608 KiB |
| random_07.txt | AC | 80 ms | 1612 KiB |
| random_08.txt | AC | 76 ms | 1604 KiB |
| random_09.txt | AC | 76 ms | 1512 KiB |
| shuffle_00.txt | AC | 70 ms | 1620 KiB |
| shuffle_01.txt | AC | 66 ms | 1608 KiB |
| shuffle_02.txt | AC | 71 ms | 1612 KiB |
| shuffle_03.txt | AC | 69 ms | 1648 KiB |
| shuffle_04.txt | AC | 70 ms | 1640 KiB |
| shuffle_05.txt | AC | 68 ms | 1508 KiB |
| shuffle_06.txt | AC | 70 ms | 1620 KiB |
| shuffle_07.txt | AC | 72 ms | 1512 KiB |
| shuffle_08.txt | AC | 70 ms | 1648 KiB |
| shuffle_09.txt | AC | 73 ms | 1612 KiB |
| shuffle_10.txt | AC | 73 ms | 1508 KiB |
| shuffle_11.txt | AC | 71 ms | 1508 KiB |
| shuffle_12.txt | AC | 74 ms | 1600 KiB |
| shuffle_13.txt | AC | 74 ms | 1584 KiB |
| shuffle_14.txt | AC | 73 ms | 1600 KiB |
| shuffle_15.txt | AC | 73 ms | 1612 KiB |
| shuffle_16.txt | AC | 71 ms | 1588 KiB |
| shuffle_17.txt | AC | 74 ms | 1612 KiB |
| shuffle_18.txt | AC | 73 ms | 1516 KiB |
| shuffle_19.txt | AC | 73 ms | 1616 KiB |
| shuffle_20.txt | AC | 74 ms | 1584 KiB |
| shuffle_21.txt | AC | 71 ms | 1616 KiB |
| shuffle_22.txt | AC | 73 ms | 1588 KiB |
| shuffle_23.txt | AC | 73 ms | 1612 KiB |
| shuffle_24.txt | AC | 73 ms | 1564 KiB |
| shuffle_25.txt | AC | 74 ms | 1592 KiB |
| shuffle_26.txt | AC | 71 ms | 1592 KiB |
| shuffle_27.txt | AC | 69 ms | 1608 KiB |
| shuffle_28.txt | AC | 70 ms | 1592 KiB |
| shuffle_29.txt | AC | 72 ms | 1564 KiB |
| shuffle_30.txt | AC | 70 ms | 1592 KiB |
| shuffle_31.txt | AC | 68 ms | 1620 KiB |
| shuffle_32.txt | AC | 73 ms | 1608 KiB |
| shuffle_33.txt | AC | 72 ms | 1588 KiB |
| shuffle_34.txt | AC | 71 ms | 1568 KiB |
| shuffle_35.txt | AC | 73 ms | 1616 KiB |