提出 #21818955
ソースコード 拡げる
#include <cstdio>
int A[1000];
int B[1000];
int main(){
int n, m;
scanf("%d%d", &n, &m);
for(int i = 0; i < n; i++){
scanf("%d", A+i);
}
for(int i = 0; i < m; i++){
scanf("%d", B+i);
}
int i = 0;
int j = 0;
while(i < n && j < m){
if(A[i] == B[j]) i++, j++;
else if(A[i] < B[j]) printf("%d ", A[i++]);
else printf("%d ", B[j++]);
}
if(i == n) while(j < m) printf("%d ", B[j++]);
if(j == m) while(i < n) printf("%d ", A[i++]);
return 0;
}
提出情報
| 提出日時 |
|
| 問題 |
B - Xor of Sequences |
| ユーザ |
ryuhei |
| 言語 |
C++ (GCC 9.2.1) |
| 得点 |
200 |
| コード長 |
518 Byte |
| 結果 |
AC |
| 実行時間 |
9 ms |
| メモリ |
1692 KiB |
コンパイルエラー
./Main.cpp: In function ‘int main()’:
./Main.cpp:9:8: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
9 | scanf("%d%d", &n, &m);
| ~~~~~^~~~~~~~~~~~~~~~
./Main.cpp:11:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
11 | scanf("%d", A+i);
| ~~~~~^~~~~~~~~~~
./Main.cpp:14:10: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
14 | scanf("%d", B+i);
| ~~~~~^~~~~~~~~~~
ジャッジ結果
| セット名 |
Sample |
All |
| 得点 / 配点 |
0 / 0 |
200 / 200 |
| 結果 |
|
|
| セット名 |
テストケース |
| Sample |
01_sample.txt, 02_sample.txt |
| All |
01_sample.txt, 02_sample.txt, 03_random.txt, 04_random.txt, 05_random.txt, 06_random.txt, 07_random.txt, 08_random.txt, 09_max.txt, 10_max.txt, 11_max.txt, 12_max.txt |
| ケース名 |
結果 |
実行時間 |
メモリ |
| 01_sample.txt |
AC |
9 ms |
1652 KiB |
| 02_sample.txt |
AC |
2 ms |
1580 KiB |
| 03_random.txt |
AC |
2 ms |
1636 KiB |
| 04_random.txt |
AC |
2 ms |
1692 KiB |
| 05_random.txt |
AC |
1 ms |
1684 KiB |
| 06_random.txt |
AC |
2 ms |
1636 KiB |
| 07_random.txt |
AC |
1 ms |
1660 KiB |
| 08_random.txt |
AC |
1 ms |
1652 KiB |
| 09_max.txt |
AC |
1 ms |
1660 KiB |
| 10_max.txt |
AC |
1 ms |
1660 KiB |
| 11_max.txt |
AC |
1 ms |
1676 KiB |
| 12_max.txt |
AC |
1 ms |
1680 KiB |