結果
| 問題 | No.1558 Derby Live | 
| コンテスト | |
| ユーザー |  沙耶花 | 
| 提出日時 | 2021-06-25 22:36:00 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                RE
                                 
                             | 
| 実行時間 | - | 
| コード長 | 1,172 bytes | 
| コンパイル時間 | 5,156 ms | 
| コンパイル使用メモリ | 255,372 KB | 
| 最終ジャッジ日時 | 2025-01-22 12:26:50 | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 5 RE * 28 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:39:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   39 |                 scanf("%d",&t);
      |                 ~~~~~^~~~~~~~~
main.cpp:43:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   43 |                         scanf("%d",&D);
      |                         ~~~~~^~~~~~~~~
main.cpp:47:38: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   47 |                                 scanf("%d",&P[j]);
      |                                 ~~~~~^~~~~~~~~~~~
main.cpp:54:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   54 |                         scanf("%d",&S);
      |                         ~~~~~^~~~~~~~~
main.cpp:69:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   69 |                         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 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;
}
            
            
            
        