結果
問題 | No.1558 Derby Live |
ユーザー | 沙耶花 |
提出日時 | 2021-06-25 22:36:00 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 1,172 bytes |
コンパイル時間 | 4,362 ms |
コンパイル使用メモリ | 263,828 KB |
実行使用メモリ | 7,648 KB |
最終ジャッジ日時 | 2023-09-07 14:44:23 |
合計ジャッジ時間 | 10,059 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | RE | - |
testcase_01 | RE | - |
testcase_02 | AC | 2 ms
4,376 KB |
testcase_03 | RE | - |
testcase_04 | AC | 48 ms
4,380 KB |
testcase_05 | AC | 53 ms
4,380 KB |
testcase_06 | AC | 88 ms
4,696 KB |
testcase_07 | RE | - |
testcase_08 | AC | 90 ms
5,436 KB |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | RE | - |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | RE | - |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | RE | - |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | AC | 2 ms
4,376 KB |
testcase_34 | AC | 2 ms
4,380 KB |
ソースコード
#include <stdio.h> #include <atcoder/all> #include <bits/stdc++.h> using namespace std; using namespace atcoder; using mint = modint998244353; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf 1000000000 int N,M,Q; using vv = vector<int>; vv op(vv a,vv b){ if(b[0]==-1)return a; if(a[0]==-1)return b; vector<int> ret(N); rep(i,N){ ret[i] = b[a[i]]; } return ret; } vv e(){ vector<int> ret(N,-1); return ret; } int main(){ cin>>N>>M>>Q; segtree<vv,op,e> seg(M); vector<int> temp = op({1,2,0},{0,2,1}); rep(i,Q){ int t; scanf("%d",&t); if(t==1){ int D; scanf("%d",&D); D--; vector<int> P(N); rep(j,N){ scanf("%d",&P[j]); P[j]--; } seg.set(D,P); } if(t==2){ int S; scanf("%d",&S); vector<int> ret = seg.prod(0,S); vector<int> ans(N); rep(j,N){ ans[ret[j]] = j; } swap(ret,ans); rep(j,N){ if(j!=0)printf(" "); printf("%d",ret[j]+1); } printf("\n"); } if(t==3){ int L,R; scanf("%d %d",&L,&R); int ans = 0; vector<int> ret = seg.prod(L-1,R); rep(j,N){ ans += abs((ret[j]) - j); } printf("%d\n",ans); } } return 0; }