QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#136467 | #186. Street Lamps | Wawi# | Compile Error | / | / | C++98 | 1.6kb | 2023-08-08 20:19:07 | 2024-07-04 01:25:30 |
Judging History
你现在查看的是最新测评结果
- [2024-07-04 01:25:30]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-08-08 20:19:07]
- 提交
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
struct item{
int first=0,second=0,val=0;
int last=0;
};
void solve(){
int n,q; cin >> n >> q;
vector<vector<int>> nums(n+1);
vector<item> calced(n+1);
vector<int> sizes(n+1,1);
for(int i=1; i <= n;i++){
char c; cin >> c;
nums[i].push_back(0);
calced[i].second=c-'0';
}
for(int i=1; i <= q;i++){
string s; cin >> s;
if(s=="query"){
int l,r; cin >> l >> r;
bool ok=calced[l].second;
// if(calced[l].first==nums[l][calced[l].last]) calced[l].last++;
for(int j=calced[l].last+1; j < sizes[l];j++){
if(ok){
calced[l].val+=nums[l][j]-calced[l].first;
ok=false;
calced[l].first=nums[l][j];
calced[l].second=0;
calced[l].last=j;
}
else ok=true,calced[l].second=1,calced[l].first=nums[l][j],calced[l].last=j;
}
if(calced[l].second){
calced[l].val+=i-calced[l].first;
}
calced[l].first=i;
cout << calced[l].val << endl;
} else{
int curr; cin >> curr;
nums[curr].push_back(i);
sizes[curr]++;
}
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int t=1;
// cin >> t;
while (t--) {
solve();
}
return 0;
}
Details
answer.code:6:14: warning: non-static data member initializers only available with ‘-std=c++11’ or ‘-std=gnu++11’ [-Wc++11-extensions] 6 | int first=0,second=0,val=0; | ^ answer.code:6:23: warning: non-static data member initializers only available with ‘-std=c++11’ or ‘-std=gnu++11’ [-Wc++11-extensions] 6 | int first=0,second=0,val=0; | ^ answer.code:6:29: warning: non-static data member initializers only available with ‘-std=c++11’ or ‘-std=gnu++11’ [-Wc++11-extensions] 6 | int first=0,second=0,val=0; | ^ answer.code:7:13: warning: non-static data member initializers only available with ‘-std=c++11’ or ‘-std=gnu++11’ [-Wc++11-extensions] 7 | int last=0; | ^ answer.code: In function ‘void solve()’: answer.code:12:22: error: ‘>>’ should be ‘> >’ within a nested template argument list 12 | vector<vector<int>> nums(n+1); | ^~ | > >