Submission #904531

# Submission time Handle Problem Language Result Execution time Memory
904531 2024-01-12T05:42:26 Z vjudge1 Land of the Rainbow Gold (APIO17_rainbow) C++17
Compilation error
0 ms 0 KB
bitset<3> was[200001];
int pref1[200005];
int pref2[200005];
int pref12[200005];
void init(int r,int c,int sr,int sc,int m,char* s){
    int px=sr,py=sc;
    was[py][px]=1;
    for(int i=0;i<m;i++){
        char u=s[i];
        if(u=='S'){
            px++;
        }else if(u=='N'){
            px--;
        }else if(u=='E'){
            py++;
        }else{
            py--;
        }
        // cout<<px<<' '<<py<<endl;
        was[py][px]=1;
    }
    for(int j=2;j<=c;j++){
        pref12[j]=pref12[j-1];
        if((was[j].count()==0 and was[j-1].count()==0) or (was[j]|was[j-1]).count()>0){
        }else{
            pref12[j]++;
        }
    }
    for(int j=2;j<=c;j++){
        pref1[j]=pref1[j-1];
        pref2[j]=pref2[j-1];
        if(was[j][1] and was[j-1][1]){
            pref1[j]++;
        }
        if(was[j][2] and was[j-1][2]){
            pref2[j]++;
        }
    }
}
int colour(int lx,int ly,int rx,int ry){
    if(lx<rx){
        return pref12[ry]-pref12[ly];
    }else if(lx==1){
        return pref1[ry]-pref1[ly];
    }else{
        return pref2[ry]-pref2[ly];
    }
}

Compilation message

rainbow.cpp:1:1: error: 'bitset' does not name a type
    1 | bitset<3> was[200001];
      | ^~~~~~
rainbow.cpp: In function 'void init(int, int, int, int, int, char*)':
rainbow.cpp:7:5: error: 'was' was not declared in this scope
    7 |     was[py][px]=1;
      |     ^~~