답안 #252403

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
252403 2020-07-25T13:01:02 Z Sugardorj 가로등 (APIO19_street_lamps) C++14
40 / 100
1018 ms 17552 KB
#include <bits/stdc++.h>
using namespace std;
int b[323567],c[223456],a[323456],tt,d[234564];
int x,m,n,t,k,l;
int i , j,r,s,y,z;
string p[12345],q;
vector <long long >v[345674];
int main(){
    cin>> n>>m>>p[0];
    if (n>100||m>100){
        for (i = 1; i<=m; i ++){
            cin >>q;
            if (q[0]=='t'){
                cin >>x;
                x--;

                if (p[0][x]=='1'){
                    p[0][x]='0';
                    a[x]+=i-b[x];
                    
                }
                else {
                    p[0][x]='1';
                    b[x]=i;
                }    
            }
            else {
                cin >>x>>y;
                x--;
                s= a[x];
                if (p[0][x]=='1')
                    s += i-b[x];
                cout << s<<endl;
            }
        }
        //cout << "duus";
        return 0;
    }
    for (i = 1; i <=m; i ++){
        cin >> q;
        p[i]=p[i-1];
        if (q[0]=='t'){
            cin >>x;
            x--;
            if (p[i][x]=='1')
                p[i][x]='0';
            else p[i][x]='1';
        }
        else {
            cin >>x>>y;
            x--;
            y--;
            s=0;
            for (k = 0; k<i; k ++){
                t=1;
                for (j = x; j<y; j ++){
                    if (p[k][j]=='0')
                        t=0;
                }
                s+=t;
            }
            cout << s<<endl;
        }
        //cout << p[i]<<endl;
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 8832 KB Output is correct
2 Correct 5 ms 8832 KB Output is correct
3 Correct 5 ms 8832 KB Output is correct
4 Correct 5 ms 8832 KB Output is correct
5 Correct 5 ms 8884 KB Output is correct
6 Correct 6 ms 8832 KB Output is correct
7 Correct 5 ms 8832 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 556 ms 9788 KB Output is correct
2 Correct 569 ms 13432 KB Output is correct
3 Correct 591 ms 14076 KB Output is correct
4 Correct 659 ms 17552 KB Output is correct
5 Correct 720 ms 16788 KB Output is correct
6 Correct 575 ms 17300 KB Output is correct
7 Correct 1014 ms 15784 KB Output is correct
8 Correct 1018 ms 17352 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 8832 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 8832 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 8832 KB Output is correct
2 Correct 5 ms 8832 KB Output is correct
3 Correct 5 ms 8832 KB Output is correct
4 Correct 5 ms 8832 KB Output is correct
5 Correct 5 ms 8884 KB Output is correct
6 Correct 6 ms 8832 KB Output is correct
7 Correct 5 ms 8832 KB Output is correct
8 Correct 556 ms 9788 KB Output is correct
9 Correct 569 ms 13432 KB Output is correct
10 Correct 591 ms 14076 KB Output is correct
11 Correct 659 ms 17552 KB Output is correct
12 Correct 720 ms 16788 KB Output is correct
13 Correct 575 ms 17300 KB Output is correct
14 Correct 1014 ms 15784 KB Output is correct
15 Correct 1018 ms 17352 KB Output is correct
16 Incorrect 6 ms 8832 KB Output isn't correct
17 Halted 0 ms 0 KB -