| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1193125 | loom | Lasers (NOI19_lasers) | C++20 | 88 ms | 8620 KiB |
#include<bits/stdc++.h>
using namespace std;
#define nl '\n'
inline void solve(){
int l, r;
cin>>l>>r;
vector<pair<int,int>> v;
for(int i=0; i<r; i++){
int x;
cin>>x;
int a[x], sum = 0;
for(int j=0; j<x; j++){
cin>>a[j];
sum += a[j];
}
int pre = 0, prev = l-sum+1;
for(int j=0; j<x; j++){
pre += a[j];
if(pre >= prev){
v.push_back({prev, 1});
v.push_back({pre+1, -1});
}
prev = l-(sum-pre)+1;
}
}
sort(v.begin(), v.end());
int n = v.size();
int ans = 0, cnt = 0;
for(int i=0; i<n; i++){
auto [x, c] = v[i];
cnt += c;
if(cnt > 0) ans += (i+1 < n ? v[i+1].first - x : l-x+1);
}
cout<<ans;
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(NULL);cout.tie(NULL);
int t = 1;
//cin>>t;
while(t--) solve();
return 0;
}| # | 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... | ||||
