| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 341178 | juggernaut | Marriage questions (IZhO14_marriage) | C++14 | 1597 ms | 2284 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
vector<vector<int>>v;
int main(){
int n,m,k;
scanf("%d%d%d",&n,&m,&k);
v.resize(n+2);
while(k--){
int x,y;
scanf("%d%d",&x,&y);
v[x].push_back(y);
}
long long ans=0;
for(int l=1;l<=n;l++){
set<int>s;
int bad=0;
for(int r=l;r<=n;r++){
for(auto to:v[r])s.insert(to);
if(v[r].empty())bad++;
if(s.size()==m&&s.size()<=(r-l+1)-bad){
ans+=n-r+1;
break;
}
}
}
printf("%lld",ans);
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
