Submission #1202298

#TimeUsernameProblemLanguageResultExecution timeMemory
1202298tegshzayaStreet Lamps (APIO19_street_lamps)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #define ll long long #define ss second #define ff first #define pb push_back #define endl "\n" using namespace std; ll n,m,o,p,ch[1005],c[1005],aa[1005]; string s,a; int main(){ ios::sync_with_stdio(false); cout.tie(0); cin.tie(0); cin>>n>>m>>s; for(ll i=1;i<=m;i++){ cin>>m; if(m[0]=='q'){ cin>>o>>p; if(s[o-1]=='1'){cout<<i-aa[o]+c[o]<<endl;} else{cout<<c[o]<<endl;} } else{ cin>>o; ch[i]=o; if(s[o-1]=='0'){ aa[o]=i; s[o-1]='1'; } else{ c[o]+=i-aa[o]; s[o-1]='0'; } } } }

Compilation message (stderr)

street_lamps.cpp: In function 'int main()':
street_lamps.cpp:17:21: error: invalid types 'long long int[int]' for array subscript
   17 |                 if(m[0]=='q'){
      |                     ^