이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define loop(i,n) for (ll i = 0; i < n; i++)
#define ll long long
#define INF 1e9+5
#define MAXN 300007
#define pb push_back
#define mp make_pair
typedef pair<ll,ll> pii;
int main(){
ll l,r,k,x,maxi=0;
cin>>l>>r;
vector<vector<ll>>row(r);
loop(i,r){
cin>>x;
maxi=max(maxi,x);
loop(j,x){
cin>>k;
row[i].pb(k);
}
}
if(maxi==1){//só há um por linha
ll savedL=INF, savedR=-1;
loop(i,r){
k=row[i][0];
savedR = max(savedR , k);
savedL = min(savedL, l-k-1);
}
k = savedL+1;
savedR=max(savedR,savedL+1);
k+=(l-savedR);
printf("%lld\n",l-k);
}else{
}
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... |