結果
問題 | No.123 カードシャッフル |
ユーザー | nmnmnmnmnmnmnm |
提出日時 | 2014-12-28 23:04:39 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 20 ms / 5,000 ms |
コード長 | 1,047 bytes |
コンパイル時間 | 724 ms |
コンパイル使用メモリ | 90,444 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 23:54:31 |
合計ジャッジ時間 | 1,701 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 10 |
ソースコード
#include <algorithm> #include <cfloat> #include <climits> #include <cmath> #include <complex> #include <cstdio> #include <cstdlib> #include <cstring> #include <functional> #include <iostream> #include <map> #include <memory> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <utility> #include <vector> using namespace std; #define sz size() #define pb push_back #define mp make_pair #define fi first #define se second #define all(c) (c).begin(), (c).end() #define rep(i,a,b) for(long long i=(a);i<(b);++i) #define clr(a, b) memset((a), (b) ,sizeof(a)) #define MOD 1000000007 int main(){ int n,m; cin>>n>>m; vector<int> a; rep(i,0,n+1){ a.pb(i); } rep(i,0,m){ int b; cin>>b; swap(a[0],a[b]); a.erase(a.begin()+b); a.insert(a.begin(),0); } cout << a[1] << endl; return 0; } /* シュミレーションの問題です。 やり方はなんとでもできるはずです。 キューとか使える人は使ってみるといいかもしれません。 */