답안 #171907

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
171907 2019-12-30T15:25:36 Z Swan 결혼 문제 (IZhO14_marriage) C++14
46 / 100
1500 ms 3320 KB
#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;
        for(int r(l);r<=n;r++){
            for(int z(0); z < v[r].size();z++)s.insert(v[r][z]);
            if(s.size()==m && s.size()<=(r-l+1)){
                ans++;
                //cout << l << ' ' << r << ' ' << s.size() << endl;
            }
        }
    }
    cout << ans;
    return 0;
}
/*
10 4
1 5 5 5 10 4 4 2 3 1
*/

Compilation message

marriage.cpp:13:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
marriage.cpp: In function 'int main()':
marriage.cpp:25:29: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             for(int z(0); z < v[r].size();z++)s.insert(v[r][z]);
                           ~~^~~~~~~~~~~~~
marriage.cpp:26:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if(s.size()==m && s.size()<=(r-l+1)){
                ~~~~~~~~^~~
marriage.cpp:26:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if(s.size()==m && s.size()<=(r-l+1)){
                               ~~~~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Incorrect 2 ms 376 KB Output isn't correct
4 Incorrect 2 ms 376 KB Output isn't correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Incorrect 2 ms 376 KB Output isn't correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Incorrect 2 ms 380 KB Output isn't correct
15 Incorrect 2 ms 376 KB Output isn't correct
16 Incorrect 2 ms 376 KB Output isn't correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 8 ms 376 KB Output is correct
20 Correct 4 ms 376 KB Output is correct
21 Correct 3 ms 376 KB Output is correct
22 Incorrect 2 ms 376 KB Output isn't correct
23 Correct 3 ms 376 KB Output is correct
24 Correct 3 ms 376 KB Output is correct
25 Correct 166 ms 556 KB Output is correct
26 Incorrect 41 ms 504 KB Output isn't correct
27 Correct 11 ms 376 KB Output is correct
28 Incorrect 4 ms 376 KB Output isn't correct
29 Correct 39 ms 504 KB Output is correct
30 Correct 33 ms 504 KB Output is correct
31 Execution timed out 1554 ms 1016 KB Time limit exceeded
32 Incorrect 223 ms 632 KB Output isn't correct
33 Correct 28 ms 376 KB Output is correct
34 Incorrect 26 ms 376 KB Output isn't correct
35 Correct 765 ms 1656 KB Output is correct
36 Correct 585 ms 1588 KB Output is correct
37 Execution timed out 1562 ms 1272 KB Time limit exceeded
38 Execution timed out 1577 ms 2040 KB Time limit exceeded
39 Incorrect 1202 ms 764 KB Output isn't correct
40 Execution timed out 1570 ms 1016 KB Time limit exceeded
41 Execution timed out 1552 ms 1148 KB Time limit exceeded
42 Execution timed out 1543 ms 1528 KB Time limit exceeded
43 Execution timed out 1572 ms 1656 KB Time limit exceeded
44 Execution timed out 1572 ms 2168 KB Time limit exceeded
45 Execution timed out 1576 ms 2040 KB Time limit exceeded
46 Execution timed out 1567 ms 3064 KB Time limit exceeded
47 Execution timed out 1551 ms 2936 KB Time limit exceeded
48 Execution timed out 1568 ms 2936 KB Time limit exceeded
49 Execution timed out 1561 ms 3320 KB Time limit exceeded
50 Execution timed out 1571 ms 1272 KB Time limit exceeded