# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
238765 | Dynamic_Cast | Lasers (NOI19_lasers) | C++14 | 1092 ms | 2296 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
//#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;
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 (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |