답안 #721491

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
721491 2023-04-11T02:34:08 Z Darren0724 가로등 (APIO19_street_lamps) C++17
20 / 100
564 ms 12964 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(),x.end()
const int INF=9e18;

int32_t main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n,q;cin>>n>>q;
    vector<int> a(n);
    for(int i=0;i<n;i++){
        char c;cin>>c;
        a[i]=c-'0'-1;
    }
    vector<int> ans(n);
    for(int i=1;i<=q;i++){
        string s;cin>>s;
        if(s=="query"){
            int x,y;cin>>x>>y;x--;y--;
            if(a[x]==-1){
                cout<<ans[x]<<endl;
            }
            else{
                cout<<ans[x]+i-a[x]<<endl;
            }
        }
        else{
            int p;cin>>p;p--;
            if(a[p]==-1){
                a[p]=i;
            }
            else{
                ans[p]+=i-a[p];
                a[p]=-1;
            }
        }
    }

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 324 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 269 ms 4416 KB Output is correct
2 Correct 304 ms 4696 KB Output is correct
3 Correct 266 ms 5308 KB Output is correct
4 Correct 317 ms 10828 KB Output is correct
5 Correct 415 ms 11332 KB Output is correct
6 Correct 277 ms 10576 KB Output is correct
7 Correct 564 ms 11544 KB Output is correct
8 Correct 483 ms 12964 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 324 KB Output isn't correct
2 Halted 0 ms 0 KB -