結果
問題 | No.255 Splarrraaay スプラーレェーーイ |
ユーザー | Kmcode1 |
提出日時 | 2015-07-24 23:03:26 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,413 bytes |
コンパイル時間 | 1,281 ms |
コンパイル使用メモリ | 114,072 KB |
実行使用メモリ | 153,112 KB |
最終ジャッジ日時 | 2024-07-08 13:31:37 |
合計ジャッジ時間 | 7,628 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | AC | 36 ms
134,784 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
コンパイルメッセージ
main.cpp: In constructor ‘st::st()’: main.cpp:39:29: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 3 has type ‘__int128*’ [-Wformat=] 39 | scanf("%d%lld%lld", &ty, &l, &r); | ~~~^ ~~ | | | | | __int128* | long long int* main.cpp:39:33: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 4 has type ‘__int128*’ [-Wformat=] 39 | scanf("%d%lld%lld", &ty, &l, &r); | ~~~^ ~~ | | | | | __int128* | long long int* main.cpp: In function ‘int main()’: main.cpp:139:19: warning: format ‘%lld’ expects argument of type ‘long long int*’, but argument 2 has type ‘__int128*’ [-Wformat=] 139 | scanf("%lld", &n); | ~~~^ ~~ | | | | | __int128* | long long int* main.cpp:139:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 139 | scanf("%lld", &n); | ~~~~~^~~~~~~~~~~~ main.cpp:141:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 141 | scanf("%d", &qq); | ~~~~~^~~~~~~~~~~ main.cpp: In constructor ‘st::st()’: main.cpp:39:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 39 | scanf("%d%lld%lld", &ty, &l, &r); | ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<iostream> #include<cstdio> #include<cstring> #include<string> #include<cctype> #include<cstdlib> #include<algorithm> #include<bitset> #include<vector> #include<list> #include<deque> #include<queue> #include<map> #include<set> #include<stack> #include<cmath> #include<sstream> #include<fstream> #include<iomanip> #include<ctime> #include<complex> #include<functional> #include<climits> #include<cassert> #include<iterator> #include<unordered_map> #include<stdint.h> #include<quadmath.h> using namespace std; #define MAX 200002 __int128 n; vector<__int128> v; __int128 MOD = 1000000000000000009LL; struct st{ int ty; __int128 l; __int128 r; st(){ scanf("%d%lld%lld", &ty, &l, &r); } }; vector<st> vv; struct s{ __int128 area = 0; int col = -1; int l=-1; int r=-1; __int128 ar[5]; s(){ for (int i = 0; i < 5; i++){ ar[i] = 0; } } }; #define MAXX 300012 s seg[MAXX * 4]; void init(int b, int l, int r){ seg[b].l = l; seg[b].r = r; seg[b].area = v[r] - v[l]; if (l + 1 == r){ return; } init(b * 2 + 1, l, (l + r) >> 1); init(b * 2 + 2, (l + r) >> 1, r); } void chang(int b, int x){ for (int i = 0; i < 5; i++){ if (i == x){ seg[b].ar[i] += seg[b].area; } else{ seg[b].ar[i] = 0; } } if (seg[b].l + 1 != seg[b].r){ seg[b * 2 + 1].col = x; seg[b * 2 + 2].col = x; } seg[b].col = -1; } void update(int b){ if (seg[b].col== -1){ return; } chang(b, seg[b].col); seg[b].col = -1; return; } inline void add(int b, int l, int r, int ll, int rr, int x){ update(b); if (rr <= l || r <= ll){ return; } if (ll <= l&&r <= rr){ chang(b, x); return; } add(b * 2 + 1, l, (l + r) >> 1, ll, rr, x); add(b * 2 + 2, (l + r) >> 1, r, ll, rr, x); for (int i = 0; i < 5; i++){ seg[b].ar[i] = seg[b * 2 + 1].ar[i] + seg[b * 2 + 2].ar[i]; } } __int128 sum[5]; inline void q(int b, int l, int r, int ll, int rr){ update(b); if (rr <= l || r <= ll){ return; } if (ll <= l&&r <= rr){ for (int i = 0; i < 5; i++){ sum[i] += seg[b].ar[i]; } return; } q(b * 2 + 1, l, (l + r) >> 1, ll, rr); q(b * 2 + 2, (l + r) >> 1, r, ll, rr); } __int128 b[5]; void output(){ for (int i = 0; i < 5; i++){ sum[i] = 0; } q(0, 0, v.size() - 1, 0, v.size() - 1); for (int i = 0; i < 5; i++){ if (i){ printf(" "); } __int128 ans = sum[i] + b[i]; ans %= MOD; long long int outt = ans; printf("%lld",outt); } puts(""); } int main(){ scanf("%lld", &n); int qq; scanf("%d", &qq); for (int i = 0; i < qq; i++){ vv.push_back(st()); v.push_back(vv.back().l); v.push_back(vv.back().r+1LL); } v.push_back(n); v.push_back(0); sort(v.begin(), v.end()); v.erase(unique(v.begin(), v.end()), v.end()); init(0, 0, v.size()-1); for (int i = 0; i < qq; i++){ int ind = lower_bound(v.begin(), v.end(), vv[i].l) - v.begin(); int ind2 = lower_bound(v.begin(), v.end(), vv[i].r + 1LL) - v.begin(); if (vv[i].ty == 0){ for (int i = 0; i < 5; i++){ sum[i] = 0; } q(0, 0, v.size() - 1, ind, ind2); int ind = 0; __int128 val = -1LL; __int128 S = 0; for (int i = 0; i < 5; i++){ if (val < sum[i]){ val = sum[i]; ind = i; } S += sum[i]; } int countt = 0; for (int i = 0; i < 5; i++){ if (val == sum[i]){ countt++; } } if (countt == 1){ b[ind] += val; } } else{ add(0, 0, v.size() - 1, ind, ind2, vv[i].ty - 1); } //output(); } output(); return 0; }