結果
問題 | No.1558 Derby Live |
ユーザー |
![]() |
提出日時 | 2021-06-25 22:38:58 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 168 ms / 2,000 ms |
コード長 | 1,104 bytes |
コンパイル時間 | 4,458 ms |
コンパイル使用メモリ | 255,748 KB |
最終ジャッジ日時 | 2025-01-22 12:28:40 |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 33 |
コンパイルメッセージ
main.cpp: In function ‘int main()’: main.cpp:36:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 36 | scanf("%d",&t); | ~~~~~^~~~~~~~~ main.cpp:40:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 40 | scanf("%d",&D); | ~~~~~^~~~~~~~~ main.cpp:44:38: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 44 | scanf("%d",&P[j]); | ~~~~~^~~~~~~~~~~~ main.cpp:51:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 51 | scanf("%d",&S); | ~~~~~^~~~~~~~~ main.cpp:66:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 66 | scanf("%d %d",&L,&R); | ~~~~~^~~~~~~~~~~~~~~
ソースコード
#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 1000000000int N,M,Q;using vv = vector<int>;vv op(vv a,vv b){vector<int> ret(N);rep(i,N){ret[i] = b[a[i]];}return ret;}vv e(){vector<int> ret(N,-1);rep(i,N)ret[i] = i;return ret;}int main(){cin>>N>>M>>Q;segtree<vv,op,e> seg(M);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;}