結果
| 問題 |
No.26 シャッフルゲーム
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-09-15 12:18:44 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 434 bytes |
| コンパイル時間 | 602 ms |
| コンパイル使用メモリ | 68,352 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-15 12:18:46 |
| 合計ジャッジ時間 | 1,200 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | WA * 10 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:10:22: warning: 'position' may be used uninitialized [-Wmaybe-uninitialized]
10 | if((position - 1) == i)v[i] = 1;
| ~~~~~~~~~~^~~~
main.cpp:6:9: note: 'position' was declared here
6 | int position,num;
| ^~~~~~~~
main.cpp:13:22: warning: 'num' may be used uninitialized [-Wmaybe-uninitialized]
13 | for(int i = 0; i < num; i++) {
| ~~^~~~~
main.cpp:6:18: note: 'num' was declared here
6 | int position,num;
| ^~~
ソースコード
#include <iostream>
#include <vector>
using namespace std;
int main(void){
// Your code here!
int position,num;
vector<int>v = {0,0,0};
for(int i = 0; i < 3; i++) {
if((position - 1) == i)v[i] = 1;
}
for(int i = 0; i < num; i++) {
int a,b,c;
cin >> a >> b;
c = v[a];
v[a] = b;
v[b] = c;
}
for(int i = 0; i < 3; i++) {
if(v[i])cout << i << endl;
}
}