Submission #239136

# Submission time Handle Problem Language Result Execution time Memory
239136 2020-06-14T14:45:31 Z Dynamic_Cast Lasers (NOI19_lasers) C++14
63 / 100
364 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;
    vi blocked(L,0);
    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)
    {
        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";
    }
    
}
# Verdict Execution time Memory Grader output
1 Runtime error 146 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 146 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 33 ms 5752 KB Output is correct
2 Correct 13 ms 4608 KB Output is correct
3 Correct 14 ms 4736 KB Output is correct
4 Correct 31 ms 6008 KB Output is correct
5 Correct 19 ms 5416 KB Output is correct
6 Correct 36 ms 6636 KB Output is correct
7 Correct 7 ms 3584 KB Output is correct
8 Correct 37 ms 6512 KB Output is correct
9 Correct 22 ms 4988 KB Output is correct
10 Correct 35 ms 5996 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 5 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 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 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 33 ms 5752 KB Output is correct
2 Correct 13 ms 4608 KB Output is correct
3 Correct 14 ms 4736 KB Output is correct
4 Correct 31 ms 6008 KB Output is correct
5 Correct 19 ms 5416 KB Output is correct
6 Correct 36 ms 6636 KB Output is correct
7 Correct 7 ms 3584 KB Output is correct
8 Correct 37 ms 6512 KB Output is correct
9 Correct 22 ms 4988 KB Output is correct
10 Correct 35 ms 5996 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 4 ms 384 KB Output is correct
13 Correct 5 ms 384 KB Output is correct
14 Correct 4 ms 384 KB Output is correct
15 Correct 4 ms 384 KB Output is correct
16 Correct 5 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 256 KB Output is correct
21 Correct 149 ms 31056 KB Output is correct
22 Correct 357 ms 4480 KB Output is correct
23 Correct 19 ms 4736 KB Output is correct
24 Correct 44 ms 7164 KB Output is correct
25 Correct 149 ms 35084 KB Output is correct
26 Correct 364 ms 6136 KB Output is correct
27 Correct 352 ms 4864 KB Output is correct
28 Correct 147 ms 35060 KB Output is correct
29 Correct 169 ms 35424 KB Output is correct
30 Correct 35 ms 6396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 146 ms 262148 KB Execution killed with signal 9 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -