# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
981366 | 2024-05-13T05:57:52 Z | pcc | Land of the Rainbow Gold (APIO17_rainbow) | C++17 | 1382 ms | 12380 KB |
#include "rainbow.h" #include <bits/stdc++.h> using namespace std; #define pii pair<int,int> #define fs first #define sc second const int mxn = 2e5+10; int arr[3][mxn]; int pref[mxn]; int row[3][mxn]; bool block(int a,int b){ return a==-1&&b==-1; } void init(int R, int C, int sr, int sc, int M, char *S) { memset(pref,0,sizeof(pref)); memset(row,0,sizeof(row)); memset(arr,0,sizeof(arr)); pii now = pii(sr,sc); arr[now.fs][now.sc] = -1; for(int i = 0;i<M;i++){ if(S[i] == 'N')now.fs--; else if(S[i] == 'S')now.fs++; else if(S[i] == 'E')now.sc++; else if(S[i] == 'W')now.sc--; arr[now.fs][now.sc] = -1; } for(int i = 1;i<=R;i++){ for(int j = 1;j<=C;j++)cerr<<setw(2)<<arr[i][j]<<' ';cerr<<endl; }cerr<<endl; arr[2][0] = arr[1][0] = -1; for(int i = 1;i<=C;i++){ row[1][i] = row[1][i-1]; row[2][i] = row[2][i-1]; pref[i] = pref[i-1]; if(!arr[1][i]&&arr[1][i-1])row[1][i]++; if(!arr[2][i]&&arr[2][i-1])row[2][i]++; if(!block(arr[1][i],arr[2][i])&&block(arr[1][i-1],arr[2][i-1]))pref[i]++; } for(int i =1;i<=C;i++)cerr<<pref[i]<<' ';cerr<<endl; return; } int colour(int ar, int ac, int br, int bc) { if(ar == br){ int cnt = row[ar][bc]-row[ar][ac]; if(!arr[ar][ac])cnt++; return cnt; } else{ int cnt = pref[bc]-pref[ac]; if(!block(arr[ar][ac],arr[br][ac]))cnt++; return cnt; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 6 ms | 11608 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 5724 KB | Output is correct |
2 | Correct | 1 ms | 5724 KB | Output is correct |
3 | Correct | 1350 ms | 8316 KB | Output is correct |
4 | Correct | 1350 ms | 11860 KB | Output is correct |
5 | Correct | 1339 ms | 11896 KB | Output is correct |
6 | Correct | 1354 ms | 11984 KB | Output is correct |
7 | Correct | 1382 ms | 12084 KB | Output is correct |
8 | Correct | 1339 ms | 11320 KB | Output is correct |
9 | Correct | 1376 ms | 11624 KB | Output is correct |
10 | Correct | 1365 ms | 11632 KB | Output is correct |
11 | Correct | 1339 ms | 12380 KB | Output is correct |
12 | Correct | 1352 ms | 11244 KB | Output is correct |
13 | Correct | 1352 ms | 11940 KB | Output is correct |
14 | Correct | 1348 ms | 11612 KB | Output is correct |
15 | Correct | 1349 ms | 11792 KB | Output is correct |
16 | Correct | 1324 ms | 11056 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 5724 KB | Output is correct |
2 | Runtime error | 7 ms | 11612 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 6 ms | 11608 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 6 ms | 11608 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |