# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
660917 | 2022-11-23T14:26:04 Z | activedeltorre | Land of the Rainbow Gold (APIO17_rainbow) | C++14 | 13 ms | 852 KB |
#include <iostream> #include <queue> #include "rainbow.h" using namespace std; int sarpe[105][105]; int fre[105][105]; int dx[10]={0,0,0,-1,1}; int dy[10]={0,1,-1,0,0}; queue <pair<int,int> >qu; int n,m; void init(int r, int c, int x, int y, int m, char *s) { int i,j,lin,col,sus,jos,st,dr,poz1,poz2,grupe=0,z; sarpe[x][y]=1; for(i=0;i<=m;i++) { if(s[i]=='N') { x--; } if(s[i]=='S') { x++; } if(s[i]=='W') { y--; } if(s[i]=='E') { y++; } sarpe[x][y]=1; } } int colour(int ar, int ac, int br, int bc) { int i,j,grupe=0,lin,col,poz1,poz2,z; for(i=ar;i<=br;i++) { for(j=ac;j<=bc;j++) { fre[i][j]=0; } } for(i=ar;i<=br;i++) { for(j=ac;j<=bc;j++) { if(fre[i][j]==0 && sarpe[i][j]==0) { grupe++; fre[i][j]=1; qu.push({i,j}); while(qu.size()) { lin=qu.front().first; col=qu.front().second; qu.pop(); for(z=1;z<=4;z++) { poz1=lin+dx[z]; poz2=col+dy[z]; if(poz1>=ar && poz2>=ac && poz1<=br && poz2<=bc && fre[poz1][poz2]==0 && sarpe[poz1][poz2]==0) { fre[poz1][poz2]=1; qu.push({poz1,poz2}); } } } } } } return grupe; }/* static int R, C, M, Q; static int sr, sc; static char S[1000 + 5]; int main() { cin>>R>>C>>M>>Q; cin>>sr>>sc; if (M > 0) { cin>>S; } init(R, C, sr, sc, M, S); int query; for (query = 0; query < Q; query++) { int ar, ac, br, bc; cin>>ar>>ac>>br>>bc; cout<<colour(ar, ac, br, bc)<<'\n'; } return 0; }*/
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 340 KB | Output is correct |
2 | Correct | 6 ms | 340 KB | Output is correct |
3 | Correct | 13 ms | 340 KB | Output is correct |
4 | Correct | 13 ms | 340 KB | Output is correct |
5 | Correct | 7 ms | 340 KB | Output is correct |
6 | Correct | 0 ms | 304 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 304 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 308 KB | Output is correct |
11 | Correct | 12 ms | 340 KB | Output is correct |
12 | Correct | 9 ms | 316 KB | Output is correct |
13 | Correct | 8 ms | 320 KB | Output is correct |
14 | Correct | 6 ms | 340 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Correct | 0 ms | 212 KB | Output is correct |
3 | Runtime error | 1 ms | 852 KB | Execution killed with signal 11 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 212 KB | Output is correct |
2 | Runtime error | 1 ms | 724 KB | Execution killed with signal 11 |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 340 KB | Output is correct |
2 | Correct | 6 ms | 340 KB | Output is correct |
3 | Correct | 13 ms | 340 KB | Output is correct |
4 | Correct | 13 ms | 340 KB | Output is correct |
5 | Correct | 7 ms | 340 KB | Output is correct |
6 | Correct | 0 ms | 304 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 304 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 308 KB | Output is correct |
11 | Correct | 12 ms | 340 KB | Output is correct |
12 | Correct | 9 ms | 316 KB | Output is correct |
13 | Correct | 8 ms | 320 KB | Output is correct |
14 | Correct | 6 ms | 340 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Runtime error | 2 ms | 852 KB | Execution killed with signal 11 |
19 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 340 KB | Output is correct |
2 | Correct | 6 ms | 340 KB | Output is correct |
3 | Correct | 13 ms | 340 KB | Output is correct |
4 | Correct | 13 ms | 340 KB | Output is correct |
5 | Correct | 7 ms | 340 KB | Output is correct |
6 | Correct | 0 ms | 304 KB | Output is correct |
7 | Correct | 0 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 304 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 0 ms | 308 KB | Output is correct |
11 | Correct | 12 ms | 340 KB | Output is correct |
12 | Correct | 9 ms | 316 KB | Output is correct |
13 | Correct | 8 ms | 320 KB | Output is correct |
14 | Correct | 6 ms | 340 KB | Output is correct |
15 | Correct | 0 ms | 212 KB | Output is correct |
16 | Correct | 0 ms | 212 KB | Output is correct |
17 | Correct | 0 ms | 212 KB | Output is correct |
18 | Runtime error | 2 ms | 852 KB | Execution killed with signal 11 |
19 | Halted | 0 ms | 0 KB | - |