QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#410732 | #1154. Wombats | kwongweng# | 9 | 57ms | 12152kb | C++17 | 1.8kb | 2024-05-14 12:46:59 | 2024-05-14 12:46:59 |
Judging History
answer
#include "wombats.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef long double ld;
typedef vector<vector<ll>> vll;
#define FOR(i, a, b) for(int i = a; i < b; i++)
#define ROF(i, a, b) for(int i = a; i >= b; i--)
#define pb push_back
#define ms memset
#define fi first
#define se second
struct segtree{
vi tl, tr, sm;
void build(int v, int l, int r){
tl[v]=l; tr[v]=r;
if (l==r) return;
int tm = (l+r)/2;
build(2*v,l,tm); build(2*v+1,tm+1,r);
}
void init(int n){
tl.assign(4*n,0); tr.assign(4*n,0);
sm.assign(4*n,0);
build(1,0,n-1);
}
void upd(int v, int pos, int val){
if (tl[v]==tr[v]){
sm[v] = val; return;
}
int tm = (tl[v]+tr[v])/2;
if (pos <= tm) upd(2*v,pos,val);
else upd(2*v+1,pos,val);
sm[v] = sm[2*v] + sm[2*v+1];
}
int get(int v, int l, int r){
if (tl[v]==l && tr[v]==r) return sm[v];
if (l>r) return 0;
int tm = (tl[v]+tr[v])/2;
return get(2*v,l,min(r,tm)) + get(2*v+1,max(l,tm+1),r);
}
};
segtree st;
int ans = 0;
vector<vi> h, v;
int r,c;
void init(int R, int C, int H[5000][200], int V[5000][200]) {
/* ... */
r=R; c=C;
FOR(i,0,R){
h.pb({});
FOR(j,0,C-1){
h[i].pb(H[i][j]);
}
}
FOR(i,0,R-1){
v.pb({});
FOR(j,0,C){
v[i].pb(V[i][j]);
ans += V[i][j];
}
}
}
void changeH(int P, int Q, int W) {
/* ... */
}
void changeV(int P, int Q, int W) {
ans += (W-v[P][0]);
v[P][0] = W;
/* ... */
}
int escape(int V1, int V2) {
return ans;
}
Details
Tip: Click on the bar to expand more detailed information
Subtask #1:
score: 9
Accepted
Test #1:
score: 9
Accepted
time: 3ms
memory: 7848kb
input:
5000 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 500 lines
Test #2:
score: 9
Accepted
time: 0ms
memory: 7924kb
input:
4999 1 447 741 689 474 539 506 732 156 94 221 858 311 318 930 146 187 13 881 960 441 480 653 504 999 274 251 772 626 944 822 314 881 695 235 952 241 204 347 821 392 641 146 316 410 305 658 977 748 363 387 550 611 991 287 105 927 679 460 660 952 310 680 669 697 768 30 25 979 743 20 624 174 877 928 46...
output:
2499534 2499661 2499736 2499923 2500085 2500946 2501218 2501738 2501625 2501253 2501148 2501154 2501273 2501617 2501635 2501466 2501560 2500971 2501220 2500994 2501607 2502361 2502491 2502352 2502386 2502494 2502289 2502643 2502459 2502771 2502603 2502938 2503119 2503397 2503204 2503545 2503698 2504...
result:
ok 500 lines
Test #3:
score: 9
Accepted
time: 57ms
memory: 8020kb
input:
5000 1 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 1000 100...
output:
4998997 4998991 4998988 4998980 4998976 4998973 4998964 4998956 4998948 4998943 4998940 4998934 4998931 4998931 4998926 4998923 4998920 4998910 4998901 4998893 4998887 4998879 4998876 4998869 4998862 4998853 4998849 4998845 4998844 4998837 4998831 4998822 4998816 4998813 4998806 4998803 4998800 4998...
result:
ok 200000 lines
Test #4:
score: 9
Accepted
time: 0ms
memory: 7860kb
input:
5000 1 433 848 657 828 954 990 864 392 35 901 873 848 527 3 10 323 871 76 674 920 258 988 801 609 433 352 603 381 683 573 25 725 353 168 801 379 735 424 34 30 843 683 987 47 745 150 974 935 557 6 13 517 660 467 324 945 274 131 510 937 19 405 11 672 269 126 814 909 957 994 394 475 181 35 266 532 873 ...
output:
2499408 2498889 2499588 2498991 2499260 2499709 2499733 2500114 2499563 2498935 2498612 2499139 2499488 2500139 2500428 2500261 2500327 2500510 2500801 2501354 2501370 2501004 2500428 2499903 2499517 2499976 2499251 2499194 2499490 2499101 2498337 2498687 2498284 2498699 2498626 2499077 2498688 2498...
result:
ok 500 lines
Test #5:
score: 9
Accepted
time: 1ms
memory: 7880kb
input:
5000 1 659 643 470 768 565 843 606 284 30 676 657 185 435 404 783 107 920 788 958 243 887 609 726 930 344 543 337 712 77 155 681 336 441 514 611 888 345 433 469 169 686 249 545 449 936 423 168 808 773 249 632 125 528 980 611 647 524 596 152 126 424 542 916 108 619 428 38 292 540 921 3 528 510 40 521...
output:
2494309 2494050 2493903 2493892 2493169 2493654 2493478 2493008 2493414 2492936 2492559 2492957 2492633 2492359 2491789 2491386 2491399 2491044 2491066 2491938 2492119 2492434 2492918 2492891 2492211 2492268 2491911 2491890 2492480 2493111 2493123 2493446 2493919 2494189 2494465 2494064 2494270 2494...
result:
ok 500 lines
Test #6:
score: 9
Accepted
time: 0ms
memory: 3724kb
input:
2 1 0 1 3 0 0
output:
0
result:
ok single line: '0'
Test #7:
score: 9
Accepted
time: 0ms
memory: 3964kb
input:
2 1 1 1 3 0 0
output:
1
result:
ok single line: '1'
Test #8:
score: 9
Accepted
time: 0ms
memory: 3688kb
input:
2 1 1000 1 3 0 0
output:
1000
result:
ok single line: '1000'
Subtask #2:
score: 0
Wrong Answer
Test #9:
score: 0
Wrong Answer
time: 1ms
memory: 3800kb
input:
20 20 1 1 1 1 1 1 1 1 0 0 1 1 1 0 0 1 0 1 0 0 0 1 0 1 0 0 0 1 0 0 1 0 0 1 0 1 1 1 0 0 0 0 1 1 0 0 0 0 0 0 1 1 1 1 0 1 0 0 1 0 0 1 1 1 0 0 0 1 1 0 0 1 1 1 1 1 0 1 1 1 0 1 0 1 1 1 1 1 0 1 0 1 1 0 0 1 0 0 1 1 1 1 0 1 0 1 1 1 0 1 0 0 0 0 1 1 0 0 1 0 0 1 1 1 1 1 1 0 0 0 1 0 0 0 0 0 1 1 0 0 1 0 0 1 1 1 0 ...
output:
196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 196 ...
result:
wrong answer 1st lines differ - expected: '2', found: '196'
Subtask #3:
score: 0
Wrong Answer
Test #18:
score: 0
Wrong Answer
time: 2ms
memory: 4064kb
input:
99 100 278 927 579 441 245 179 75 110 797 424 854 825 213 194 8 666 556 81 205 126 225 882 913 85 319 94 784 83 486 391 262 251 623 746 706 453 842 242 414 876 885 88 175 334 971 539 90 860 11 32 402 776 314 301 966 800 744 20 777 681 535 55 191 1 773 503 55 223 285 3 136 505 644 175 686 454 2 818 3...
output:
4902529 4901559 4899480 4900355 4900845 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901557 4901...
result:
wrong answer 1st lines differ - expected: '34137', found: '4902529'
Subtask #4:
score: 0
Wrong Answer
Test #25:
score: 0
Wrong Answer
time: 0ms
memory: 12152kb
input:
4999 2 57 194 293 623 704 290 534 103 734 55 774 398 571 972 268 57 567 207 425 914 855 650 38 540 496 242 353 263 889 192 216 416 414 54 80 451 456 956 809 169 909 394 244 936 77 180 653 263 338 732 752 739 250 759 738 450 431 243 50 897 790 606 389 146 148 878 611 707 802 623 187 98 653 244 127 75...
output:
4999318 4999318 4998507 4998507 4998815 4998815 4997957 4997957 4998151 4998151 4998146 4998146 4998146 4998146 4998251 4998251 4998251 4998251 4998251 4998251 4999114 4999114 4999114 4999114 4999114 4999114 4999114 4999114 4999114 4999114 4998790 4998790 4998790 4998790 4998125 4998125 4998060 4998...
result:
wrong answer 1st lines differ - expected: '2116460', found: '4999318'
Subtask #5:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%
Subtask #6:
score: 0
Skipped
Dependency #1:
100%
Accepted
Dependency #2:
0%