답안 #238766

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
238766 2020-06-12T17:16:54 Z Dynamic_Cast Lasers (NOI19_lasers) C++14
24 / 100
1000 ms 27632 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 main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    int L,R,X,temp;
    cin>>L>>R;
    vi append;
    vector<vi> wall;
    int f,maxx;
    int flag=1;
    for(int i=0;i<R;i++){
        cin>>X;
        if(X>1){
            flag=0;
        }
        for(int j=0;j<X;j++){
            cin>>temp;
            maxx=max(temp,maxx);
            append.PB(temp);    
        }
        wall.PB(append);
        if(X>0){
            append.clear();
        }
    }
    if (flag == 1)
    {
        cout << max(2 * maxx - L, 0) << "\n";
    }
    if(flag==0){
        int count=0;
        for (int i = 0; i < R; i++)
        {
            for (int j = 1; j < int(wall[i].size()); j++)
            {
                wall[i][j]+=wall[i][j-1];
                //cout<<wall[i][j]<<"\n";
            }
        }
        int f2=0;
        for(int i=0;i<L;i++){
            f = 0;
            for (int j = 0; j < R; j++)
            {
                f2=0;
                if ((wall[j][int(wall[j].size()) - 1]) < L - i)
                {
                    f2 = 1;
                    continue;
                }
                for (int k = 0; k < int(wall[j].size()); k++)
                {
                    if (wall[j][k] <= i && (wall[j][int(wall[j].size()) - 1] - wall[j][k]) < L-i)
                    {
                        f2=1;
                        break;
                    }
                }
                if (f2 == 0)
                {
                    f = 1;
                    count++;
                    //cout<<"laser "<<i<<" cant pass through row "<<j<<"\n";
                    break;
                }
            }
        }
        cout<<count<<"\n";
    }

    
}

Compilation message

lasers.cpp: In function 'int main()':
lasers.cpp:32:9: warning: variable 'f' set but not used [-Wunused-but-set-variable]
     int f,maxx;
         ^
lasers.cpp:51:23: warning: 'maxx' may be used uninitialized in this function [-Wmaybe-uninitialized]
         cout << max(2 * maxx - L, 0) << "\n";
                     ~~^~~~~~
# 결과 실행 시간 메모리 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 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 4 ms 384 KB Output is correct
9 Correct 5 ms 304 KB Output is correct
10 Correct 4 ms 384 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 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 4 ms 384 KB Output is correct
9 Correct 5 ms 304 KB Output is correct
10 Correct 4 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 162 ms 27332 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 5 ms 384 KB Output is correct
17 Correct 163 ms 27632 KB Output is correct
18 Correct 4 ms 384 KB Output is correct
19 Correct 4 ms 384 KB Output is correct
20 Correct 4 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1094 ms 2296 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 5 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 Incorrect 5 ms 384 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1094 ms 2296 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 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 4 ms 384 KB Output is correct
9 Correct 5 ms 304 KB Output is correct
10 Correct 4 ms 384 KB Output is correct
11 Correct 5 ms 384 KB Output is correct
12 Correct 162 ms 27332 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 5 ms 384 KB Output is correct
17 Correct 163 ms 27632 KB Output is correct
18 Correct 4 ms 384 KB Output is correct
19 Correct 4 ms 384 KB Output is correct
20 Correct 4 ms 384 KB Output is correct
21 Execution timed out 1094 ms 2296 KB Time limit exceeded
22 Halted 0 ms 0 KB -