Submission #904543

# Submission time Handle Problem Language Result Execution time Memory
904543 2024-01-12T05:47:32 Z vjudge1 Land of the Rainbow Gold (APIO17_rainbow) C++17
Compilation error
0 ms 0 KB
int 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]|=(1<<px);
    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]|=(1<<px);
    }
    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)&1 and (was[j-1]>>1)&1){
            pref1[j]++;
        }
        if((was[j]>>2)&1 and (was[j-1]>>2)&1){
            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: In function 'void init(int, int, int, int, int, char*)':
rainbow.cpp:24:20: error: request for member 'count' in 'was[j]', which is of non-class type 'int'
   24 |         if((was[j].count()==0 and was[j-1].count()==0) or (was[j]|was[j-1]).count()>0){
      |                    ^~~~~
rainbow.cpp:24:44: error: request for member 'count' in 'was[(j - 1)]', which is of non-class type 'int'
   24 |         if((was[j].count()==0 and was[j-1].count()==0) or (was[j]|was[j-1]).count()>0){
      |                                            ^~~~~
rainbow.cpp:24:77: error: request for member 'count' in '(was[j] | was[(j - 1)])', which is of non-class type 'int'
   24 |         if((was[j].count()==0 and was[j-1].count()==0) or (was[j]|was[j-1]).count()>0){
      |                                                                             ^~~~~