結果
| 問題 | No.123 カードシャッフル |
| コンテスト | |
| ユーザー |
hogeover30
|
| 提出日時 | 2015-01-28 19:48:18 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 290 bytes |
| コンパイル時間 | 421 ms |
| コンパイル使用メモリ | 52,640 KB |
| 最終ジャッジ日時 | 2024-11-14 18:58:00 |
| 合計ジャッジ時間 | 1,111 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:8:5: error: ‘vector’ was not declared in this scope
8 | vector<int> a(n);
| ^~~~~~
main.cpp:3:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’?
2 | #include <algorithm>
+++ |+#include <vector>
3 | using namespace std;
main.cpp:8:12: error: expected primary-expression before ‘int’
8 | vector<int> a(n);
| ^~~
main.cpp:9:27: error: ‘a’ was not declared in this scope
9 | for(int i=1;i<=n;++i) a[i-1]=i;
| ^
main.cpp:12:22: error: ‘a’ was not declared in this scope
12 | rotate(begin(a), begin(a)+t-1, begin(a)+t);
| ^
main.cpp:14:11: error: ‘a’ was not declared in this scope
14 | cout<<a.front()<<endl;
| ^
ソースコード
#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n, m;
cin>>n>>m;
vector<int> a(n);
for(int i=1;i<=n;++i) a[i-1]=i;
while (m--) {
int t; cin>>t;
rotate(begin(a), begin(a)+t-1, begin(a)+t);
}
cout<<a.front()<<endl;
}
hogeover30