結果
| 問題 |
No.26 シャッフルゲーム
|
| コンテスト | |
| ユーザー |
dgd1724
|
| 提出日時 | 2016-09-09 18:47:04 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 577 bytes |
| コンパイル時間 | 1,491 ms |
| コンパイル使用メモリ | 68,376 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-16 08:53:43 |
| 合計ジャッジ時間 | 1,120 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <time.h>
#include <cstdlib>
#include <cmath>
#include <fstream>
int main(void) {
//test用
//std::ifstream in("test.txt");
//std::cin.rdbuf(in.rdbuf());
int N, M;
std::cin >> N >> M;
std::vector<int> n(3);
n[N - 1] = 1;
for (int i = 0; i < M; i++) {
int P, Q;
std::cin >> P >> Q;
int temp;
temp = n[P - 1];
n[P - 1] = n[Q - 1];
n[Q - 1] = temp;
}
size_t index = std::distance(n.begin(),std::find(n.begin(), n.end(), 1));
std::cout << index + 1 << std::endl;
}
dgd1724