Submission #171908

# Submission time Handle Problem Language Result Execution time Memory
171908 2019-12-30T15:26:44 Z Swan Marriage questions (IZhO14_marriage) C++14
28 / 100
1500 ms 2552 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++){
            if(!v[r].size())break;
            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:26: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:27:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if(s.size()==m && s.size()<=(r-l+1)){
                ~~~~~~~~^~~
marriage.cpp:27:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
             if(s.size()==m && s.size()<=(r-l+1)){
                               ~~~~~~~~^~~~~~~~~
# Verdict Execution time Memory 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 Incorrect 2 ms 376 KB Output isn't correct
6 Incorrect 2 ms 376 KB Output isn't correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 380 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Incorrect 2 ms 376 KB Output isn't correct
14 Incorrect 2 ms 376 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 Incorrect 2 ms 376 KB Output isn't correct
18 Incorrect 2 ms 376 KB Output isn't correct
19 Correct 8 ms 376 KB Output is correct
20 Correct 4 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Incorrect 2 ms 376 KB Output isn't correct
23 Incorrect 3 ms 376 KB Output isn't correct
24 Incorrect 3 ms 376 KB Output isn't correct
25 Correct 162 ms 564 KB Output is correct
26 Incorrect 13 ms 376 KB Output isn't correct
27 Correct 2 ms 376 KB Output is correct
28 Incorrect 3 ms 376 KB Output isn't correct
29 Incorrect 42 ms 504 KB Output isn't correct
30 Incorrect 35 ms 504 KB Output isn't correct
31 Execution timed out 1566 ms 632 KB Time limit exceeded
32 Incorrect 63 ms 504 KB Output isn't correct
33 Correct 2 ms 380 KB Output is correct
34 Incorrect 14 ms 376 KB Output isn't correct
35 Incorrect 746 ms 1608 KB Output isn't correct
36 Incorrect 588 ms 1560 KB Output isn't correct
37 Execution timed out 1549 ms 1272 KB Time limit exceeded
38 Execution timed out 1559 ms 1528 KB Time limit exceeded
39 Incorrect 210 ms 764 KB Output isn't correct
40 Correct 8 ms 1036 KB Output is correct
41 Incorrect 22 ms 1016 KB Output isn't correct
42 Execution timed out 1547 ms 1528 KB Time limit exceeded
43 Execution timed out 1561 ms 1656 KB Time limit exceeded
44 Execution timed out 1539 ms 1784 KB Time limit exceeded
45 Incorrect 20 ms 1912 KB Output isn't correct
46 Incorrect 245 ms 2424 KB Output isn't correct
47 Execution timed out 1555 ms 2296 KB Time limit exceeded
48 Execution timed out 1531 ms 2296 KB Time limit exceeded
49 Incorrect 374 ms 2552 KB Output isn't correct
50 Incorrect 212 ms 1144 KB Output isn't correct