結果
問題 | No.1558 Derby Live |
ユーザー | NullKara |
提出日時 | 2021-06-25 22:21:11 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 2,160 bytes |
コンパイル時間 | 798 ms |
コンパイル使用メモリ | 72,436 KB |
実行使用メモリ | 12,908 KB |
最終ジャッジ日時 | 2023-09-07 14:36:17 |
合計ジャッジ時間 | 7,734 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | TLE | - |
testcase_01 | -- | - |
testcase_02 | -- | - |
testcase_03 | -- | - |
testcase_04 | -- | - |
testcase_05 | -- | - |
testcase_06 | -- | - |
testcase_07 | -- | - |
testcase_08 | -- | - |
testcase_09 | -- | - |
testcase_10 | -- | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
ソースコード
#include <iostream> #include <vector> #include <algorithm> using namespace std; int N, M; typedef pair<int,int> pint; vector<pint> A; bool cmp(pint a, pint b) { return a.second < b.second; } int main() { int N,M,Q; cin>>N>>M>>Q; int kuk[M+1][N]; for(int i=0;i<N;i++){ kuk[0][i]=i+1; } while(Q-->0){ int qu; cin>>qu; if(qu==1){ int D; cin>>D; for(int i=0;i<N;i++){ int P; cin>>P; kuk[D][i]=P; } } if(qu==2){ int S; cin>>S; int dat[N]; for(int i=0;i<N;i++){ dat[i]=i+1; } for(int i=1;i<=S;i++){ int ndat[N]; for(int j=0;j<N;j++){ ndat[kuk[i][j]-1]=dat[j]; } for(int j=0;j<N;j++){ dat[j]=ndat[j]; } } for(int i=0;i<N-1;i++){ cout<<dat[i]<<" "; } cout<<dat[N-1]<<endl; } if(qu==3){ int l,r; cin>>l>>r; l--; int dat[N]; int ldat[N]; int rdat[N]; for(int i=0;i<N;i++){ dat[i]=i+1; ldat[i]=i+1; } for(int i=1;i<=r;i++){ int ndat[N]; for(int j=0;j<N;j++){ ndat[kuk[i][j]-1]=dat[j]; } for(int j=0;j<N;j++){ dat[j]=ndat[j]; } if(l==i){ for(int j=0;j<N;j++){ ldat[j]=ndat[j]; } } if(r==i){ for(int j=0;j<N;j++){ rdat[j]=ndat[j]; } } } int ans=0; for(int i=0;i<N;i++){ //cout<<rdat[i]<<","<<ldat[i]<<endl; ans+=abs(rdat[i]-ldat[i]); } cout<<ans<<endl; } } }