結果

問題 No.5011 Better Mo's Algorithm is Needed!! (Weighted)
ユーザー hotman78hotman78
提出日時 2022-12-23 16:46:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 351 ms / 5,000 ms
コード長 863 bytes
コンパイル時間 2,405 ms
実行使用メモリ 12,192 KB
スコア 35,847,712,540
最終ジャッジ日時 2022-12-23 16:48:29
合計ジャッジ時間 84,254 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
純コード判定しない問題か言語
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 296 ms
10,684 KB
testcase_01 AC 311 ms
10,684 KB
testcase_02 AC 306 ms
11,200 KB
testcase_03 AC 292 ms
11,392 KB
testcase_04 AC 300 ms
11,732 KB
testcase_05 AC 325 ms
10,916 KB
testcase_06 AC 308 ms
11,368 KB
testcase_07 AC 299 ms
10,800 KB
testcase_08 AC 314 ms
11,060 KB
testcase_09 AC 326 ms
10,532 KB
testcase_10 AC 302 ms
11,164 KB
testcase_11 AC 308 ms
11,328 KB
testcase_12 AC 302 ms
11,212 KB
testcase_13 AC 309 ms
11,740 KB
testcase_14 AC 296 ms
10,864 KB
testcase_15 AC 311 ms
11,744 KB
testcase_16 AC 317 ms
10,940 KB
testcase_17 AC 309 ms
11,580 KB
testcase_18 AC 301 ms
10,576 KB
testcase_19 AC 328 ms
10,648 KB
testcase_20 AC 331 ms
11,176 KB
testcase_21 AC 316 ms
11,340 KB
testcase_22 AC 294 ms
10,916 KB
testcase_23 AC 327 ms
10,652 KB
testcase_24 AC 302 ms
10,792 KB
testcase_25 AC 297 ms
10,800 KB
testcase_26 AC 313 ms
10,648 KB
testcase_27 AC 302 ms
11,444 KB
testcase_28 AC 304 ms
11,588 KB
testcase_29 AC 315 ms
11,652 KB
testcase_30 AC 303 ms
11,652 KB
testcase_31 AC 299 ms
11,128 KB
testcase_32 AC 305 ms
11,400 KB
testcase_33 AC 316 ms
11,472 KB
testcase_34 AC 306 ms
11,368 KB
testcase_35 AC 301 ms
11,132 KB
testcase_36 AC 315 ms
11,160 KB
testcase_37 AC 310 ms
11,656 KB
testcase_38 AC 304 ms
10,656 KB
testcase_39 AC 318 ms
10,940 KB
testcase_40 AC 317 ms
11,924 KB
testcase_41 AC 312 ms
10,948 KB
testcase_42 AC 336 ms
10,536 KB
testcase_43 AC 318 ms
11,124 KB
testcase_44 AC 317 ms
11,316 KB
testcase_45 AC 308 ms
11,176 KB
testcase_46 AC 306 ms
10,628 KB
testcase_47 AC 313 ms
11,992 KB
testcase_48 AC 298 ms
11,132 KB
testcase_49 AC 291 ms
10,940 KB
testcase_50 AC 322 ms
10,684 KB
testcase_51 AC 300 ms
10,864 KB
testcase_52 AC 308 ms
10,336 KB
testcase_53 AC 308 ms
11,328 KB
testcase_54 AC 305 ms
10,656 KB
testcase_55 AC 316 ms
11,436 KB
testcase_56 AC 302 ms
10,864 KB
testcase_57 AC 294 ms
10,632 KB
testcase_58 AC 329 ms
10,868 KB
testcase_59 AC 299 ms
10,576 KB
testcase_60 AC 302 ms
11,472 KB
testcase_61 AC 313 ms
11,108 KB
testcase_62 AC 293 ms
11,052 KB
testcase_63 AC 307 ms
11,848 KB
testcase_64 AC 302 ms
11,408 KB
testcase_65 AC 318 ms
10,528 KB
testcase_66 AC 351 ms
10,596 KB
testcase_67 AC 313 ms
11,432 KB
testcase_68 AC 304 ms
11,972 KB
testcase_69 AC 336 ms
11,120 KB
testcase_70 AC 307 ms
11,176 KB
testcase_71 AC 298 ms
11,996 KB
testcase_72 AC 304 ms
10,600 KB
testcase_73 AC 319 ms
11,104 KB
testcase_74 AC 332 ms
12,192 KB
testcase_75 AC 301 ms
11,400 KB
testcase_76 AC 299 ms
10,680 KB
testcase_77 AC 322 ms
11,108 KB
testcase_78 AC 299 ms
11,204 KB
testcase_79 AC 301 ms
11,404 KB
testcase_80 AC 311 ms
10,944 KB
testcase_81 AC 306 ms
11,472 KB
testcase_82 AC 304 ms
10,800 KB
testcase_83 AC 300 ms
10,792 KB
testcase_84 AC 299 ms
11,904 KB
testcase_85 AC 323 ms
10,604 KB
testcase_86 AC 306 ms
10,868 KB
testcase_87 AC 298 ms
11,704 KB
testcase_88 AC 321 ms
10,652 KB
testcase_89 AC 305 ms
10,872 KB
testcase_90 AC 300 ms
11,204 KB
testcase_91 AC 333 ms
11,120 KB
testcase_92 AC 302 ms
11,112 KB
testcase_93 AC 312 ms
11,216 KB
testcase_94 AC 299 ms
11,848 KB
testcase_95 AC 304 ms
11,132 KB
testcase_96 AC 325 ms
11,160 KB
testcase_97 AC 306 ms
10,892 KB
testcase_98 AC 303 ms
10,600 KB
testcase_99 AC 322 ms
10,604 KB
testcase_100 AC 297 ms
11,208 KB
testcase_101 AC 301 ms
10,628 KB
testcase_102 AC 315 ms
12,164 KB
testcase_103 AC 303 ms
10,604 KB
testcase_104 AC 312 ms
10,792 KB
testcase_105 AC 299 ms
10,940 KB
testcase_106 AC 303 ms
10,524 KB
testcase_107 AC 321 ms
10,652 KB
testcase_108 AC 298 ms
10,652 KB
testcase_109 AC 302 ms
11,360 KB
testcase_110 AC 331 ms
10,348 KB
testcase_111 AC 298 ms
11,180 KB
testcase_112 AC 302 ms
10,612 KB
testcase_113 AC 310 ms
10,796 KB
testcase_114 AC 301 ms
11,216 KB
testcase_115 AC 303 ms
10,676 KB
testcase_116 AC 301 ms
11,372 KB
testcase_117 AC 316 ms
11,060 KB
testcase_118 AC 327 ms
11,372 KB
testcase_119 AC 299 ms
10,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define all(n) (n).begin(),(n).end()
using lint=long long;
constexpr __int128_t maxn = __int128_t(1) << 100;
__int128_t hilbertorder(__int128_t x, __int128_t y) {
  __int128_t rx, ry, d = 0;
  for (__int128_t s=maxn>>1; s; s>>=1) {
    rx = (x & s)>0, ry = (y & s)>0;
    d += s * s * ((rx * 3) ^ ry);
    if (ry) continue;
    if (rx) {
      x = maxn-1 - x;
      y = maxn-1 - y;
    }
    swap(x, y);
  }
  return d;
}



int main(){
	lint n,q,wt,st;
	cin>>n>>q>>wt>>st;
    vector<lint>w(n),ws(n+1);
    rep(i,0,n)cin>>w[i];
    rep(i,0,n)ws[i+1]+=ws[i]+w[i];
    vector<pair<lint,int>>v;
    rep(i,0,n){
        int x,y;
        cin>>x>>y;
        v.emplace_back(hilbertorder(ws[x],ws[y]),i);
    }
    sort(all(v));
    rep(i,0,n)cout<<v[i].second+1<<" \n"[i==n-1];
}
0