# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
227604 | Autoratch | Lasers (NOI19_lasers) | C++14 | 146 ms | 10080 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 1;
int m,n;
vector<pair<int,int> > a;
int tmp[N];
int main()
{
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> m >> n;
for(int i = 1;i <= n;i++)
{
int am,sum = 0;
cin >> am;
for(int j = 0;j < am;j++){ int x; cin >> x; sum+=x; tmp[j] = x; }
int ll = 0,rr = sum;
for(int j = 0;j < am;j++)
{
rr-=tmp[j];
int l = ll+tmp[j],r = m-rr-tmp[j]+1;
if(r<=l) a.push_back({r,l});
ll+=tmp[j];
}
}
sort(a.begin(),a.end());
int now = 0,ans = 0;
for(auto [x,y] : a)
{
if(now<x) now = y,ans+=y-x+1;
else if(y>now) ans+=y-now,now = y;
}
cout << ans;
}
컴파일 시 표준 에러 (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... |