Submission #68562034
Source Code Expand
#include <stdio.h>
#include <string.h>
int main(){
int N, M;
scanf("%d %d", &N, &M);
char S[N+1];
scanf("%s", S);
// printf("OK\n");
char T[N+1];
scanf("%s", T);
// printf("OK2\n");
int L[M], R[M];
for(int i = 0; i < M; i++){
scanf("%d %d", &L[i], &R[i]);
}
// char tmp[N];
// for(int i = 0; i < M; i++){
// // printf("ここまでOK\n");
// int diff = R[i] - L[i] + 1;
// // printf("ここまでOK2\n");
// // printf("diff %d", diff);
// for(int j = 0; j < diff; j++){
// tmp[j] = S[L[i]-1 + j];
// S[L[i]-1 + j] = T[L[i]-1 + j];
// T[L[i]-1 + j] = tmp[j];
// }
// // printf("%s\n", S);
// }
// printf("OK?\n");
int not[N+1];
for(int i = 0; i <= N; i++){
not[i] = 0;
}
for(int i = 0; i < M; i++){
not[L[i]-1] += 1;
not[R[i]] -= 1;
}
// for(int i = 0; i < N; i++){
// printf("%d ", not[i]);
// }
// putchar('\n');
int cur = 0;
for(int i = 0; i < N; i++){
cur += not[i];
if(cur % 2 == 0){
printf("%c", S[i]);
}else{
printf("%c", T[i]);
}
}
printf("\n");
return 0;
}
Submission Info
| Submission Time |
|
| Task |
D - Substr Swap |
| User |
oinucha |
| Language |
C (gcc 12.2.0) |
| Score |
400 |
| Code Size |
1330 Byte |
| Status |
AC |
| Exec Time |
41 ms |
| Memory |
6140 KiB |
Compile Error
Main.c: In function ‘main’:
Main.c:6:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d %d", &N, &M);
| ^~~~~~~~~~~~~~~~~~~~~~
Main.c:9:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
9 | scanf("%s", S);
| ^~~~~~~~~~~~~~
Main.c:12:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%s", T);
| ^~~~~~~~~~~~~~
Main.c:17:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
17 | scanf("%d %d", &L[i], &R[i]);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Judge Result
| Set Name |
Sample |
All |
| Score / Max Score |
0 / 0 |
400 / 400 |
| Status |
|
|
| Set Name |
Test Cases |
| Sample |
00_sample_00.txt, 00_sample_01.txt |
| All |
00_sample_00.txt, 00_sample_01.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt |
| Case Name |
Status |
Exec Time |
Memory |
| 00_sample_00.txt |
AC |
0 ms |
1560 KiB |
| 00_sample_01.txt |
AC |
0 ms |
1612 KiB |
| 01_test_00.txt |
AC |
0 ms |
1560 KiB |
| 01_test_01.txt |
AC |
0 ms |
1648 KiB |
| 01_test_02.txt |
AC |
0 ms |
1608 KiB |
| 01_test_03.txt |
AC |
0 ms |
1560 KiB |
| 01_test_04.txt |
AC |
2 ms |
1692 KiB |
| 01_test_05.txt |
AC |
17 ms |
3012 KiB |
| 01_test_06.txt |
AC |
15 ms |
3172 KiB |
| 01_test_07.txt |
AC |
12 ms |
4476 KiB |
| 01_test_08.txt |
AC |
35 ms |
5372 KiB |
| 01_test_09.txt |
AC |
36 ms |
5744 KiB |
| 01_test_10.txt |
AC |
41 ms |
5948 KiB |
| 01_test_11.txt |
AC |
41 ms |
6108 KiB |
| 01_test_12.txt |
AC |
36 ms |
6052 KiB |
| 01_test_13.txt |
AC |
40 ms |
6140 KiB |