結果
| 問題 |
No.26 シャッフルゲーム
|
| コンテスト | |
| ユーザー |
rsk0315
|
| 提出日時 | 2020-03-15 21:53:47 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 5,000 ms |
| コード長 | 319 bytes |
| コンパイル時間 | 878 ms |
| コンパイル使用メモリ | 54,900 KB |
| 最終ジャッジ日時 | 2025-01-09 07:09:47 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:7:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%zu %zu", &n, &m);
| ~~~~~^~~~~~~~~~~~~~~~~~~
main.cpp:14:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | scanf("%zu %zu", &p, &q);
| ~~~~~^~~~~~~~~~~~~~~~~~~
ソースコード
#include <cstdio>
#include <string>
#include <utility>
int main() {
size_t n, m;
scanf("%zu %zu", &n, &m);
std::string s = "xxx";
s[n-1] = 'o';
for (size_t i = 0; i < m; ++i) {
size_t p, q;
scanf("%zu %zu", &p, &q);
--p, --q;
std::swap(s[p], s[q]);
}
printf("%zu\n", s.find('o')+1);
}
rsk0315