Submission #3769485
Source Code Expand
#include<stdio.h> int check(char s[][11], int i){ int l, m, n; n = 0; for(l = 0; l < i; l++){ m = 0; while(s[l][m] != 0 || s[i][m] != 0){ if(s[l][m] != s[i][m]){ n++; break; } else { m++; } } } if(n == i){ return 1; } else { return 0; } } char last(char s[]){ char c; int i = 0; while(s[i] != 0){ c = s[i]; i++; } return c; } int main(){ int N, i, j; scanf("%d", &N); char s[N][11]; int c = 1; for(i = 0; i < N; i++){ scanf("%s", &s[i][0]); if(i != 0){ if(last(s[i - 1]) != s[i][0]){ c *= 0; } c *= check(s, i); } } if(c == 0) printf("No\n"); else printf("Yes\n"); return 0; }
Submission Info
Submission Time | |
---|---|
Task | B - Shiritori |
User | Casta46 |
Language | C (GCC 5.4.1) |
Score | 200 |
Code Size | 792 Byte |
Status | AC |
Exec Time | 1 ms |
Memory | 128 KB |
Compile Error
./Main.c: In function ‘main’: ./Main.c:35:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &N); ^ ./Main.c:41:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%s", &s[i][0]); ^
Judge Result
Set Name | All | Sample | ||||
---|---|---|---|---|---|---|
Score / Max Score | 200 / 200 | 0 / 0 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
All | max_1, max_2, max_3, max_4, min_1, no1_1, no1_2, no2_1, no2_2, random_1, random_2, sample_01, sample_02, sample_03, sample_04, yes_1, yes_2 |
Sample | sample_01, sample_02, sample_03, sample_04 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
max_1 | AC | 1 ms | 128 KB |
max_2 | AC | 1 ms | 128 KB |
max_3 | AC | 1 ms | 128 KB |
max_4 | AC | 1 ms | 128 KB |
min_1 | AC | 0 ms | 128 KB |
no1_1 | AC | 1 ms | 128 KB |
no1_2 | AC | 1 ms | 128 KB |
no2_1 | AC | 1 ms | 128 KB |
no2_2 | AC | 1 ms | 128 KB |
random_1 | AC | 1 ms | 128 KB |
random_2 | AC | 1 ms | 128 KB |
sample_01 | AC | 1 ms | 128 KB |
sample_02 | AC | 1 ms | 128 KB |
sample_03 | AC | 1 ms | 128 KB |
sample_04 | AC | 1 ms | 128 KB |
yes_1 | AC | 1 ms | 128 KB |
yes_2 | AC | 1 ms | 128 KB |