結果

問題 No.1558 Derby Live
ユーザー noya2noya2
提出日時 2021-05-08 12:51:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 256 ms / 2,000 ms
コード長 3,852 bytes
コンパイル時間 4,808 ms
コンパイル使用メモリ 272,524 KB
実行使用メモリ 9,188 KB
最終ジャッジ日時 2024-06-25 08:00:50
合計ジャッジ時間 15,107 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 201 ms
9,188 KB
testcase_01 AC 256 ms
8,672 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 167 ms
6,944 KB
testcase_04 AC 81 ms
6,940 KB
testcase_05 AC 96 ms
6,948 KB
testcase_06 AC 158 ms
6,940 KB
testcase_07 AC 7 ms
6,944 KB
testcase_08 AC 154 ms
6,940 KB
testcase_09 AC 158 ms
7,248 KB
testcase_10 AC 165 ms
7,284 KB
testcase_11 AC 174 ms
7,280 KB
testcase_12 AC 180 ms
7,380 KB
testcase_13 AC 188 ms
8,016 KB
testcase_14 AC 196 ms
8,028 KB
testcase_15 AC 208 ms
8,016 KB
testcase_16 AC 212 ms
7,896 KB
testcase_17 AC 219 ms
8,784 KB
testcase_18 AC 227 ms
8,792 KB
testcase_19 AC 236 ms
8,740 KB
testcase_20 AC 240 ms
8,656 KB
testcase_21 AC 227 ms
8,784 KB
testcase_22 AC 234 ms
8,788 KB
testcase_23 AC 241 ms
8,780 KB
testcase_24 AC 226 ms
8,660 KB
testcase_25 AC 233 ms
8,792 KB
testcase_26 AC 239 ms
8,788 KB
testcase_27 AC 225 ms
8,788 KB
testcase_28 AC 234 ms
8,916 KB
testcase_29 AC 244 ms
8,664 KB
testcase_30 AC 224 ms
8,652 KB
testcase_31 AC 232 ms
8,788 KB
testcase_32 AC 239 ms
8,788 KB
testcase_33 AC 2 ms
6,940 KB
testcase_34 AC 2 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
/*
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
using bint = mp::cpp_int;
*/
#include <atcoder/all>
#include <iostream>
#include <queue>
#include <stack>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <random>
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define repp(i,n,m) for (int i = m; i < (n); ++i)
using namespace std;
using namespace atcoder;
using namespace internal;
//alias g++='g++ -I/mnt/c/Users/Owner/Desktop/ac-library'
using ll = long long;
using ld = long double;
using P = pair<int, int>;
using PI = pair<pair<int,int>,int>;
using PL = pair<long long, long long>;
using PLL = pair<pair<long long, long long>, long long>;
using Pxy = pair<long double, long double>;
const int INF = 1001001007;
const int modd = 1000000007;
const long long modl = 1000000007LL;
const long long mod = 998244353LL;
const ll inf = 2e18;

template <typename SA>
void priv(vector<SA> &ar){
    if (ar.size() == 0) cout << endl;
    else {
        rep(i,int(ar.size()-1)) cout << ar[i] << " ";
        cout << ar[ar.size()-1] << endl;
    }
}
template <typename SB>
void privv(vector<vector<SB>> &ar){
    rep(i,int(ar.size())){
        priv(ar[i]);
    }
}
template <typename SC>
bool range(SC a, SC b, SC x){return (a <= x && x < b);}
bool rrange(P a, P b, P xy){
    return (range(a.first,b.first,xy.first) && range(a.second,b.second,xy.second));
}
template <typename SD>
void sor(vector<SD> &ar){sort(ar.begin(),ar.end());}
template <typename SE>
void rev(vector<SE> &ar){reverse(ar.begin(),ar.end());}
template <typename SF>
bool chmin(SF &a, const SF &b){if(a>b){a = b; return true;} return false;}
template <typename SG>
bool chmax(SG &a, const SG &b){if(a<b){a = b; return true;} return false;}
template <typename SH>
void eru(vector<SH> &ar){sor(ar);ar.erase(unique(ar.begin(),ar.end()),ar.end());}
template <typename SI>
SI   last(vector<SI> &ar){return ar[ar.size()-1];}
template <typename SJ>
SJ   cel(SJ a, SJ b){if (a % b == 0) return a/b; return a/b +1;}
template <typename SK, typename SL>
void pout(pair<SK,SL> p) {cout << p.first << " " << p.second << endl;}

void yes(){cout << "Yes" << endl;}
void no (){cout << "No" << endl;}
void yn (bool t){if(t)yes();else no();}
void Yes(){cout << "YES" << endl;}
void No (){cout << "NO" << endl;}
void YN (bool t){if(t)Yes();else No();}
void dout() {cout << setprecision(20);}

vector<int> dx = {0,1,0,-1};
vector<int> dy = {1,0,-1,0};
const string ALP = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string alp = "abcdefghijklmnopqrstuvwxyz";

ll gcds(ll a, ll b){
    ll c = a % b;
    while (c != 0){
        a = b;
        b = c;
        c = a % b;
    }
    return b;
}


int n = 0;
vector<int> res;

vector<int> op(vector<int> a, vector<int> b){
    vector<int> ans(n);
    rep(i,n) ans[i] = b[a[i]];
    return ans;
}

vector<int> e(){
    return res;
}

int main(){
    int m, q; cin >> n >> m >> q;
    res.resize(n);
    rep(i,n) res[i] = i;
    segtree<vector<int>,op,e> seg(m);
    vector<vector<int>> ans;
    rep(i,q){
        int t; cin >> t;
        if (t == 1){
            int b; cin >> b;
            b--;
            vector<int> p(n);
            rep(j,n) {
                cin >> p[j];
                p[j]--;
            }
            seg.set(b,p);
        }
        else if (t == 2){
            int s; cin >> s;
            vector<int> rec = seg.prod(0,s);
            vector<int> add(n);
            rep(j,n) add[rec[j]] = j+1;
            ans.emplace_back(add);
        }
        else if (t == 3){
            int l, r; cin >> l >> r;
            vector<int> rec = seg.prod(l-1,r);
            vector<int> excite = {0};
            rep(j,n) excite[0] += abs(j - rec[j]);
            ans.emplace_back(excite);
        }
    }
    privv(ans);
}
0