답안 #700716

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
700716 2023-02-19T08:29:41 Z coding_snorlax 가로등 (APIO19_street_lamps) C++14
20 / 100
716 ms 9664 KB
#include<bits/stdc++.h>
using namespace std;
int List[300002];
int answer[300002];
bool Now[300002];
int main(){
    int N,Q;
    cin>>N>>Q;
    for(int i=1;i<=N;i++){
        char s;
        cin>>s;
        if(s-'0') List[i]=0;
        else List[i]=-1;
        Now[i]=s-'0';
    }
    for(int i=1;i<=Q;i++){
        string s;
        int a,b;
        cin>>s;
        if(s=="query"){
            cin>>a>>b;
            if(List[a]!=-1) cout<<answer[a]+i-List[a]<<"\n";
            else cout<<answer[a]<<"\n";
        }
        else{
            cin>>a;
            if(Now[a]){
                Now[a]=1-Now[a];
                answer[a]+=i-List[a];
                List[a]=-1;
            }
            else{
                Now[a]=1-Now[a];
                List[a]=i;
            }
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 410 ms 4348 KB Output is correct
2 Correct 465 ms 4696 KB Output is correct
3 Correct 432 ms 5280 KB Output is correct
4 Correct 510 ms 8760 KB Output is correct
5 Correct 522 ms 7960 KB Output is correct
6 Correct 453 ms 8496 KB Output is correct
7 Correct 712 ms 8288 KB Output is correct
8 Correct 716 ms 9664 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 3 ms 320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -