Submission #3025011
Source Code Expand
#define SIZE 100001 #include<stdio.h> int main(){ int N,M; int a[SIZE], b[SIZE]; int group[SIZE][2]; scanf("%d", &N); scanf("%d", &M); for(int i=0; i<M; i++){ scanf("%d %d", &a[i], &b[i]); } group[0][0] = a[0]; group[0][1] = b[0]; int group_num = 1; int new_group_flag = 0; for(int i=1; i<M; i++){ //check subject i for(int j=0; j<group_num; j++){ //check group j if(a[i] < group[j][1] && group[j][0] < b[i]){ //subject i belongs to group j if(a[i] > group[j][0]){ group[j][0] = a[i]; } if(b[i] < group[j][1]){ group[j][1] = b[i]; } new_group_flag = 0; } else{ //other group or new group new_group_flag = 1; } } if(new_group_flag){ group_num++; group[group_num-1][0] = a[i]; group[group_num-1][1] = b[i]; } } printf("%d\n", group_num); return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Islands War |
User | htkaaa |
Language | C (GCC 5.4.1) |
Score | 0 |
Code Size | 907 Byte |
Status | WA |
Exec Time | 2103 ms |
Memory | 1152 KB |
Compile Error
./Main.c: In function ‘main’: ./Main.c:10:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &N); ^ ./Main.c:11:3: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d", &M); ^ ./Main.c:14:5: warning: ignoring return value of ‘scanf’, declared with attribute warn_unused_result [-Wunused-result] scanf("%d %d", &a[i], &b[i]); ^
Judge Result
Set Name | Sample | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 400 | ||||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample_01, sample_02, sample_03 |
All | 0_small_0, 0_small_1, 0_small_10, 0_small_2, 0_small_3, 0_small_4, 0_small_5, 0_small_6, 0_small_7, 0_small_8, 0_small_9, 1_rand_0, 1_rand_1, 1_rand_2, 1_rand_3, 1_rand_4, 1_rand_5, 1_rand_6, 1_rand_7, 1_rand_8, 1_rand_9, 2_max_0, 2_max_1, 2_max_2, 2_max_3, 2_max_4, 2_max_5, 2_max_6, 2_max_7, 2_max_8, 2_max_9, 3_nosub_0, 3_nosub_1, 3_nosub_2, 3_nosub_3, 3_nosub_4, 3_nosub_5, 3_nosub_6, 3_nosub_7, 3_nosub_8, 3_nosub_9, sample_01, sample_02, sample_03 |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_small_0 | AC | 0 ms | 128 KB |
0_small_1 | AC | 1 ms | 128 KB |
0_small_10 | WA | 1 ms | 128 KB |
0_small_2 | WA | 1 ms | 128 KB |
0_small_3 | WA | 1 ms | 128 KB |
0_small_4 | WA | 1 ms | 128 KB |
0_small_5 | WA | 1 ms | 128 KB |
0_small_6 | WA | 1 ms | 128 KB |
0_small_7 | WA | 1 ms | 128 KB |
0_small_8 | WA | 1 ms | 128 KB |
0_small_9 | WA | 1 ms | 128 KB |
1_rand_0 | WA | 18 ms | 256 KB |
1_rand_1 | WA | 1395 ms | 640 KB |
1_rand_2 | TLE | 2103 ms | 1024 KB |
1_rand_3 | TLE | 2103 ms | 1024 KB |
1_rand_4 | WA | 166 ms | 384 KB |
1_rand_5 | TLE | 2103 ms | 896 KB |
1_rand_6 | WA | 1518 ms | 640 KB |
1_rand_7 | TLE | 2103 ms | 896 KB |
1_rand_8 | WA | 828 ms | 512 KB |
1_rand_9 | TLE | 2103 ms | 1024 KB |
2_max_0 | TLE | 2103 ms | 1152 KB |
2_max_1 | TLE | 2103 ms | 1152 KB |
2_max_2 | TLE | 2103 ms | 1152 KB |
2_max_3 | TLE | 2103 ms | 1152 KB |
2_max_4 | TLE | 2103 ms | 1152 KB |
2_max_5 | TLE | 2103 ms | 1152 KB |
2_max_6 | TLE | 2103 ms | 1152 KB |
2_max_7 | TLE | 2103 ms | 1152 KB |
2_max_8 | TLE | 2103 ms | 1152 KB |
2_max_9 | TLE | 2103 ms | 1152 KB |
3_nosub_0 | TLE | 2103 ms | 1152 KB |
3_nosub_1 | TLE | 2103 ms | 1152 KB |
3_nosub_2 | TLE | 2103 ms | 1152 KB |
3_nosub_3 | TLE | 2103 ms | 1152 KB |
3_nosub_4 | TLE | 2103 ms | 1152 KB |
3_nosub_5 | TLE | 2103 ms | 1152 KB |
3_nosub_6 | TLE | 2103 ms | 1152 KB |
3_nosub_7 | TLE | 2103 ms | 1152 KB |
3_nosub_8 | TLE | 2103 ms | 1152 KB |
3_nosub_9 | TLE | 2103 ms | 1152 KB |
sample_01 | AC | 0 ms | 128 KB |
sample_02 | AC | 1 ms | 128 KB |
sample_03 | AC | 0 ms | 128 KB |