Submission #3606185
Source Code Expand
#include <stdio.h> #include <stdlib.h> int main(void) { int T, N, M; int takoyaki[100], customer[100]; int current_num = 0; //何個目まで売れているか unsigned char flag = 1; int i, j; scanf("%d%*c", &T); scanf("%d%*c", &N); for(i = 0; i < N; i++){ scanf("%d%*c", &takoyaki[i]); } scanf("%d%*c", &M); for(i = 0; i < M; i++){ scanf("%d%*c", &customer[i]); } //客の方が多ければ問答無用でno if(M > N){ flag = 0; }else{ //客に対して for(i = 0; i < M; i++){ //たこ焼きを一つずつ見ていく for(j = current_num; j < N; j++){ if(abs(customer[i] - takoyaki[j]) <= T){ current_num = j + 1; break; } if(j == N - 1 && abs(customer[i] - takoyaki[j]) > T){ flag = 0; break; } } if(flag == 0) break; } } if(flag == 1){ printf("yes\n"); }else{ printf("no\n"); } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - おいしいたこ焼きの売り方 |
User | gotyu |
Language | C (GCC 5.4.1) |
Score | 0 |
Code Size | 1194 Byte |
Status | WA |
Exec Time | 1 ms |
Memory | 128 KB |
Compile Error
./Main.c: In function ‘main’: ./Main.c:12:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%*c", &T); ^ ./Main.c:13:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%*c", &N); ^ ./Main.c:15:9: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%*c", &takoyaki[i]); ^ ./Main.c:17:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%*c", &M); ^ ./Main.c:19:9: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d%*c", &customer[i]); ^
Judge Result
Set Name | All | ||||
---|---|---|---|---|---|
Score / Max Score | 0 / 100 | ||||
Status |
|
Set Name | Test Cases |
---|---|
All | rand0.txt, rand1.txt, rand10.txt, rand11.txt, rand12.txt, rand13.txt, rand14.txt, rand15.txt, rand16.txt, rand17.txt, rand18.txt, rand19.txt, rand2.txt, rand20.txt, rand21.txt, rand22.txt, rand23.txt, rand24.txt, rand25.txt, rand26.txt, rand27.txt, rand28.txt, rand29.txt, rand3.txt, rand4.txt, rand5.txt, rand6.txt, rand7.txt, rand8.txt, rand9.txt, s1.txt, s2.txt, s3.txt, s4.txt, s5.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
rand0.txt | AC | 1 ms | 128 KB |
rand1.txt | AC | 1 ms | 128 KB |
rand10.txt | AC | 1 ms | 128 KB |
rand11.txt | AC | 1 ms | 128 KB |
rand12.txt | AC | 1 ms | 128 KB |
rand13.txt | WA | 1 ms | 128 KB |
rand14.txt | WA | 1 ms | 128 KB |
rand15.txt | AC | 1 ms | 128 KB |
rand16.txt | WA | 1 ms | 128 KB |
rand17.txt | AC | 1 ms | 128 KB |
rand18.txt | WA | 1 ms | 128 KB |
rand19.txt | AC | 1 ms | 128 KB |
rand2.txt | AC | 1 ms | 128 KB |
rand20.txt | WA | 1 ms | 128 KB |
rand21.txt | AC | 1 ms | 128 KB |
rand22.txt | AC | 1 ms | 128 KB |
rand23.txt | AC | 1 ms | 128 KB |
rand24.txt | AC | 1 ms | 128 KB |
rand25.txt | WA | 1 ms | 128 KB |
rand26.txt | AC | 1 ms | 128 KB |
rand27.txt | AC | 1 ms | 128 KB |
rand28.txt | AC | 1 ms | 128 KB |
rand29.txt | AC | 1 ms | 128 KB |
rand3.txt | AC | 1 ms | 128 KB |
rand4.txt | AC | 1 ms | 128 KB |
rand5.txt | AC | 1 ms | 128 KB |
rand6.txt | AC | 1 ms | 128 KB |
rand7.txt | AC | 1 ms | 128 KB |
rand8.txt | AC | 1 ms | 128 KB |
rand9.txt | WA | 1 ms | 128 KB |
s1.txt | AC | 1 ms | 128 KB |
s2.txt | AC | 1 ms | 128 KB |
s3.txt | AC | 1 ms | 128 KB |
s4.txt | WA | 1 ms | 128 KB |
s5.txt | AC | 1 ms | 128 KB |