답안 #341180

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
341180 2020-12-29T05:11:51 Z juggernaut 결혼 문제 (IZhO14_marriage) C++14
64 / 100
1500 ms 2304 KB
#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);
    }
    int 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++;
            }
        }
    }
    printf("%d",ans);
}

Compilation message

marriage.cpp: In function 'int main()':
marriage.cpp:20:24: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |             if(s.size()==m&&s.size()<=(r-l+1)-bad){
      |                ~~~~~~~~^~~
marriage.cpp:20:37: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |             if(s.size()==m&&s.size()<=(r-l+1)-bad){
      |                             ~~~~~~~~^~~~~~~~~~~~~
marriage.cpp:6:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    6 |     scanf("%d%d%d",&n,&m,&k);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~
marriage.cpp:10:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   10 |         scanf("%d%d",&x,&y);
      |         ~~~~~^~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 0 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 0 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 0 ms 364 KB Output is correct
14 Incorrect 1 ms 364 KB Output isn't correct
15 Incorrect 1 ms 364 KB Output isn't correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 7 ms 364 KB Output is correct
20 Correct 2 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 169 ms 492 KB Output is correct
26 Incorrect 40 ms 364 KB Output isn't correct
27 Correct 10 ms 396 KB Output is correct
28 Correct 3 ms 364 KB Output is correct
29 Correct 40 ms 364 KB Output is correct
30 Correct 33 ms 364 KB Output is correct
31 Execution timed out 1588 ms 620 KB Time limit exceeded
32 Incorrect 223 ms 492 KB Output isn't correct
33 Correct 27 ms 364 KB Output is correct
34 Correct 24 ms 364 KB Output is correct
35 Correct 752 ms 972 KB Output is correct
36 Correct 595 ms 876 KB Output is correct
37 Execution timed out 1599 ms 748 KB Time limit exceeded
38 Execution timed out 1598 ms 1132 KB Time limit exceeded
39 Correct 1178 ms 748 KB Output is correct
40 Execution timed out 1600 ms 876 KB Time limit exceeded
41 Execution timed out 1598 ms 876 KB Time limit exceeded
42 Execution timed out 1600 ms 1132 KB Time limit exceeded
43 Execution timed out 1595 ms 1132 KB Time limit exceeded
44 Execution timed out 1590 ms 1388 KB Time limit exceeded
45 Execution timed out 1547 ms 1644 KB Time limit exceeded
46 Execution timed out 1585 ms 2304 KB Time limit exceeded
47 Execution timed out 1590 ms 2028 KB Time limit exceeded
48 Execution timed out 1595 ms 2028 KB Time limit exceeded
49 Execution timed out 1562 ms 2156 KB Time limit exceeded
50 Execution timed out 1552 ms 1132 KB Time limit exceeded