답안 #239139

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
239139 2020-06-14T14:47:34 Z Dynamic_Cast Lasers (NOI19_lasers) C++14
87 / 100
376 ms 262148 KB
//#include <bits/stdc++.h> C++11
#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <cmath>
#include <stdio.h>
#include <time.h>
#include <iomanip>
#include <stdlib.h>
#include <list>
#include <stack>
#include <queue>
#include <climits>
#include <map>
#include <set>
#include <sstream>
using namespace std;
typedef long long ll;
typedef pair<int, int> pi;
typedef vector<int> vi;
#define PB push_back
#define MP make_pair
int HashFunction(int k){
    return (k*167-1)*131-k*3;
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int L, R, X, temp;
    cin >> L >> R;
    vi append;
    vector<vi> wall;
    int flag, maxx;
    flag = 1;
    maxx = 0;
    for (int i = 0; i < R; i++)
    {
        cin >> X;
        if (X > 1)
        {
            flag = 0;
        }
        cin >> temp;
        maxx = max(maxx, temp);
        append.PB(temp);
        for (int j = 1; j < X; j++)
        {
            cin >> temp;
            maxx = max(maxx, temp);
            append.PB(temp+append[j-1]);
        }
        wall.PB(append);
        append.clear();
        
    }
    if (flag == 1)
    {
        cout << max(2 * maxx - L, 0) << "\n";
    }
    if (flag == 0)
    {
        vi blocked(L,0);
        int space;
        int count=0;
        for (int i = 0; i < R; i++)
        {
            for(int j=0;j<int(wall[i].size());j++){
                if(j==0){
                    space=L-(wall[i][int(wall[i].size())-1]-wall[i][j]);
                    //cout<<"space (for wall "<<j<<" in line "<<i<<") = "<<space<<"\n";
                    for(int k=space-wall[i][j];k<wall[i][j];k++){
                        if(blocked[k]==0){
                            blocked[k]=1;
                            count++;
                        }
                    }
                }
                else{
                    space=L-(wall[i][int(wall[i].size())-1]-wall[i][j])-wall[i][j-1];
                    //cout<<"space (for wall "<<j<<" in line "<<i<<") = "<<space<<"\n";
                    for(int k=wall[i][j-1]+space-(wall[i][j]-wall[i][j-1]);k<wall[i][j];k++){
                        if(blocked[k]==0){
                            blocked[k]=1;
                            count++;
                        }
                    }
                }
            }
        }
        cout << count << "\n";
    }
    
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 161 ms 27144 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 162 ms 27660 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 4 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 5752 KB Output is correct
2 Correct 14 ms 4608 KB Output is correct
3 Correct 14 ms 4736 KB Output is correct
4 Correct 30 ms 6000 KB Output is correct
5 Correct 19 ms 5284 KB Output is correct
6 Correct 34 ms 6632 KB Output is correct
7 Correct 7 ms 3584 KB Output is correct
8 Correct 41 ms 6380 KB Output is correct
9 Correct 21 ms 4988 KB Output is correct
10 Correct 34 ms 6008 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 4 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 31 ms 5752 KB Output is correct
2 Correct 14 ms 4608 KB Output is correct
3 Correct 14 ms 4736 KB Output is correct
4 Correct 30 ms 6000 KB Output is correct
5 Correct 19 ms 5284 KB Output is correct
6 Correct 34 ms 6632 KB Output is correct
7 Correct 7 ms 3584 KB Output is correct
8 Correct 41 ms 6380 KB Output is correct
9 Correct 21 ms 4988 KB Output is correct
10 Correct 34 ms 6008 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 4 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 4 ms 384 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 4 ms 384 KB Output is correct
21 Correct 150 ms 27528 KB Output is correct
22 Correct 360 ms 4480 KB Output is correct
23 Correct 18 ms 4480 KB Output is correct
24 Correct 43 ms 5952 KB Output is correct
25 Correct 142 ms 27528 KB Output is correct
26 Correct 350 ms 4856 KB Output is correct
27 Correct 376 ms 4352 KB Output is correct
28 Correct 147 ms 27528 KB Output is correct
29 Correct 149 ms 27528 KB Output is correct
30 Correct 36 ms 5372 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 4 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 4 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 4 ms 384 KB Output is correct
10 Correct 5 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 161 ms 27144 KB Output is correct
13 Correct 4 ms 384 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 384 KB Output is correct
16 Correct 5 ms 384 KB Output is correct
17 Correct 162 ms 27660 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 4 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 31 ms 5752 KB Output is correct
22 Correct 14 ms 4608 KB Output is correct
23 Correct 14 ms 4736 KB Output is correct
24 Correct 30 ms 6000 KB Output is correct
25 Correct 19 ms 5284 KB Output is correct
26 Correct 34 ms 6632 KB Output is correct
27 Correct 7 ms 3584 KB Output is correct
28 Correct 41 ms 6380 KB Output is correct
29 Correct 21 ms 4988 KB Output is correct
30 Correct 34 ms 6008 KB Output is correct
31 Correct 5 ms 384 KB Output is correct
32 Correct 4 ms 384 KB Output is correct
33 Correct 4 ms 384 KB Output is correct
34 Correct 4 ms 384 KB Output is correct
35 Correct 5 ms 384 KB Output is correct
36 Correct 4 ms 384 KB Output is correct
37 Correct 5 ms 384 KB Output is correct
38 Correct 5 ms 384 KB Output is correct
39 Correct 5 ms 384 KB Output is correct
40 Correct 4 ms 384 KB Output is correct
41 Correct 150 ms 27528 KB Output is correct
42 Correct 360 ms 4480 KB Output is correct
43 Correct 18 ms 4480 KB Output is correct
44 Correct 43 ms 5952 KB Output is correct
45 Correct 142 ms 27528 KB Output is correct
46 Correct 350 ms 4856 KB Output is correct
47 Correct 376 ms 4352 KB Output is correct
48 Correct 147 ms 27528 KB Output is correct
49 Correct 149 ms 27528 KB Output is correct
50 Correct 36 ms 5372 KB Output is correct
51 Runtime error 163 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
52 Halted 0 ms 0 KB -