답안 #267374

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
267374 2020-08-16T04:14:13 Z blue 가로등 (APIO19_street_lamps) C++11
20 / 100
5000 ms 69132 KB
#include <iostream>
#include <string>
using namespace std;

int main()
{
    int n, q;
    cin >> n >> q;

    string S;
    cin >> S;

    bool on[n+1];
    for(int i = 1; i <= n; i++) on[i] = S[i-1] == '1';

    int drive[n+1][n+2];
    for(int a = 1; a <= n; a++) for(int b = a; b <= n+1; b++) drive[a][b] = 0;


    int A, B;

    for(int i = 1; i <= q; i++)
    {
        for(int a = 1; a <= n; a++)
        {
            for(int b = a+1; b <= n+1; b++)
            {
                if(!on[b-1]) break;
                drive[a][b]++;
            }
        }

        cin >> S;
        if(S == "toggle")
        {
            cin >> A;
            on[A] = !on[A];
        }
        else
        {
            cin >> A >> B;
            cout << drive[A][B] << '\n';
        }
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 793 ms 4524 KB Output is correct
2 Correct 1063 ms 5240 KB Output is correct
3 Execution timed out 5088 ms 69132 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 15 ms 4224 KB Output is correct
2 Correct 20 ms 4224 KB Output is correct
3 Correct 22 ms 4224 KB Output is correct
4 Correct 431 ms 4224 KB Output is correct
5 Runtime error 16 ms 2332 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 4352 KB Output is correct
2 Correct 10 ms 4224 KB Output is correct
3 Correct 9 ms 4224 KB Output is correct
4 Correct 11 ms 4224 KB Output is correct
5 Runtime error 15 ms 2332 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 384 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 384 KB Output is correct
8 Correct 793 ms 4524 KB Output is correct
9 Correct 1063 ms 5240 KB Output is correct
10 Execution timed out 5088 ms 69132 KB Time limit exceeded
11 Halted 0 ms 0 KB -