Submission #900918

# Submission time Handle Problem Language Result Execution time Memory
900918 2024-01-09T05:20:01 Z svaz Land of the Rainbow Gold (APIO17_rainbow) C++14
0 / 100
584 ms 1048576 KB
#include "rainbow.h"
#include<bits/stdc++.h>
using namespace std;
vector< vector<int> >mat;
void init(int R, int C, int sr, int sc, int M, char *S) {
    for(int i=0;i<R;i++){
        vector<int> fil(C,1);
        mat.push_back(fil);
    }
    sr--;
    sc--;
    mat[sr][sc]=0;
    for(int i=0;i<M;i++){
        int dir=S[i];
        if(dir=='N')sr--;
        if(dir=='W')sc--;
        if(dir=='S')sr++;
        if(dir=='E')sc++;
        if(sr>=0 && sr<R && sc>=0 && sc<C) mat[sr][sc]=0;
        else{
            if(sr<0)sr=0;
            if(sr>=R)sr=R-1;
            if(sc<0)sc=0;
            if(sc>=C)sc=C-1;
        }
    }
}
int colour(int ar, int ac, int br, int bc) {
    ar--;
    ac--;
    br--;
    bc--;
    int c=mat[ar][ac]+mat[br][bc];
    return c;
    return 0;
}
/*int main(){
    int R,C,M,Q,sr,sc,ar,ac,br,bc;
    string S;
    cin>>R>>C>>M>>Q;
    cin>>sr>>sc;
    cin>>S;
    init(R,C,sr,sc,M,S);
    for(int i=0;i<Q;i++){
        cin>>ar>>ac>>br>>bc;
        int ans=colours(ar,ac,br,bc);
        cout<<ans<<"\n";
    }
    return 0;
}*/
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 440 KB Output is correct
2 Runtime error 584 ms 1048576 KB Execution killed with signal 9
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -