| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 171909 | Swan | 결혼 문제 (IZhO14_marriage) | C++14 | 1579 ms | 2424 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define stop system("pause")
#define stop2 char o; cin >> o
#define INP freopen("pcb.in","r",stdin)
#define OUTP freopen ("pcb.out","w",stdout)
//#define int long long
using namespace std;
const int maxn = 100004;
vector<vector<int> > v;
main(){
    ios_base::sync_with_stdio(0);
    int n,m,k; cin >> n >> m >> k;
    v.resize(n+2);
    for(int i(0); i < k;i++){
        int a,b; cin >> a >> b;
        v[a].push_back(b);
    }
    int ans = 0;
    for(int l(1);l<=n;l++){
        set<int> s;
        int bad = 0;
        for(int r(l);r<=n;r++){
            for(int z(0); z < v[r].size();z++)s.insert(v[r][z]);
            if(!v[r].size())bad++;
            if(s.size()==m && s.size()<=(r-l+1)-bad){
                ans++;
                //cout << l << ' ' << r << ' ' << s.size() << endl;
            }
        }
    }
    cout << ans;
    return 0;
}
/*
10 4
1 5 5 5 10 4 4 2 3 1
*/
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
