답안 #743066

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
743066 2023-05-17T07:44:36 Z Sainen420 Lasers (NOI19_lasers) C++17
45 / 100
129 ms 13856 KB
#include <bits/stdc++.h>
using namespace std;
using pi = pair<int,int>;

int l,r,in,n,ans=0;
int qs[50002]={};
vector<pi> ep;

int main()
{
    cin.tie(nullptr)->sync_with_stdio(false);
    cin >> l >> r;
    qs[0]=0;
    for(int i=0;i<r;i++){
        cin >> n;
        for(int j=1;j<=n;j++){
            cin >> qs[j];
            qs[j]+=qs[j-1];
        }
        //qs[n+1]=qs[n];
        for(int j=1;j<=n;j++){
            //gen ep
            int sp=qs[j-1],sn=qs[n]-qs[j],val=qs[j]-qs[j-1];
            int L=val,M=l-sn-sp;
            //cout << '=' << L << ' ' << M << endl;
            if(M-L+1 > L)continue;
            ep.push_back({M-L+1+sp,1});
            ep.push_back({L+1+sp,-1});
        }
    }
    sort(ep.begin(),ep.end());
    ep.push_back({l,-9999});
    int block=0;
    for(int i=0,j=ep.size()-1;i<j;i++){
        auto[indx,v]=ep[i];
        //cout << indx << ' ' << v << ' ' << endl;
        block+=v;
        if(block>=1 && (ep[i+1]).first > indx){
            ans+=((ep[i+1]).first - indx);
        }
    }
    cout << ans;
    return 0;
}
/*
11 3
2 2 3
1 7
2 4 1
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 126 ms 13856 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 129 ms 9396 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 1236 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
8 Correct 1 ms 340 KB Output is correct
9 Correct 1 ms 340 KB Output is correct
10 Correct 1 ms 328 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 1236 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 340 KB Output is correct
12 Correct 126 ms 13856 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 340 KB Output is correct
17 Correct 129 ms 9396 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Runtime error 3 ms 1236 KB Execution killed with signal 11
22 Halted 0 ms 0 KB -