답안 #1038681

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1038681 2024-07-30T06:05:10 Z 김은성(#10985) Card Collection (JOI24_collection) C++17
11 / 100
4000 ms 260176 KB
#include <bits/stdc++.h>
using namespace std;
set<pair<int, int> > dp[2009][2009];
int a[2009], b[2009];
int main(){
    int n, m, i, t, j, k;
    scanf("%d %d", &n, &m);
    for(i=1; i<=n; i++){
        scanf("%d %d", &a[i], &b[i]);
    }
    for(t=0; t<n; t++){
        for(i=1; i<=n; i++){
            j = i+t;
            if(i==j){
                dp[i][j].insert(make_pair(a[i], b[i]));
            }
            else{
                for(k=i; k<j; k++){
                    for(auto it1 = dp[i][k].begin(); it1 != dp[i][k].end(); it1++){
                        for(auto it2 = dp[k+1][j].begin(); it2 != dp[k+1][j].end(); it2++){
                            dp[i][j].insert(make_pair(min(it1->first, it2->first), min(it1->second, it2->second)));
                            dp[i][j].insert(make_pair(max(it1->first, it2->first), max(it1->second, it2->second)));
                        }
                    }
                }
            }
        }
    }
    int u, v;
    vector<int> vec;
    for(i=1; i<=m; i++){
        scanf("%d %d", &u, &v);
        if(dp[1][n].find(make_pair(u, v)) != dp[1][n].end())
            vec.push_back(i);
    }
    for(i=0; i<vec.size(); i++)
        printf("%d ", vec[i]);
    printf("\n");
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:36:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     for(i=0; i<vec.size(); i++)
      |              ~^~~~~~~~~~~
Main.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf("%d %d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~
Main.cpp:9:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |         scanf("%d %d", &a[i], &b[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
Main.cpp:32:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |         scanf("%d %d", &u, &v);
      |         ~~~~~^~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 189868 KB Output is correct
2 Correct 74 ms 189776 KB Output is correct
3 Correct 74 ms 189840 KB Output is correct
4 Correct 80 ms 189936 KB Output is correct
5 Correct 73 ms 189860 KB Output is correct
6 Correct 75 ms 189884 KB Output is correct
7 Correct 77 ms 189776 KB Output is correct
8 Correct 74 ms 189820 KB Output is correct
9 Correct 75 ms 189776 KB Output is correct
10 Correct 76 ms 189776 KB Output is correct
11 Correct 73 ms 189772 KB Output is correct
12 Correct 74 ms 190036 KB Output is correct
13 Correct 81 ms 190032 KB Output is correct
14 Correct 79 ms 190024 KB Output is correct
15 Correct 79 ms 190032 KB Output is correct
16 Correct 80 ms 190032 KB Output is correct
17 Correct 88 ms 189988 KB Output is correct
18 Correct 85 ms 190248 KB Output is correct
19 Correct 97 ms 190292 KB Output is correct
20 Correct 72 ms 189780 KB Output is correct
21 Correct 71 ms 189824 KB Output is correct
22 Correct 76 ms 189776 KB Output is correct
23 Correct 72 ms 189920 KB Output is correct
24 Correct 69 ms 189776 KB Output is correct
25 Correct 73 ms 189776 KB Output is correct
26 Correct 74 ms 189888 KB Output is correct
27 Correct 84 ms 190036 KB Output is correct
28 Correct 77 ms 190036 KB Output is correct
29 Correct 85 ms 190204 KB Output is correct
30 Correct 98 ms 190272 KB Output is correct
31 Correct 100 ms 190288 KB Output is correct
32 Correct 102 ms 190544 KB Output is correct
33 Correct 120 ms 190476 KB Output is correct
34 Correct 74 ms 190032 KB Output is correct
35 Correct 149 ms 190600 KB Output is correct
36 Correct 79 ms 190036 KB Output is correct
37 Correct 76 ms 190036 KB Output is correct
38 Correct 76 ms 190036 KB Output is correct
39 Correct 79 ms 190036 KB Output is correct
40 Correct 76 ms 190008 KB Output is correct
41 Correct 73 ms 190036 KB Output is correct
42 Correct 76 ms 189840 KB Output is correct
43 Correct 75 ms 190036 KB Output is correct
44 Correct 75 ms 190000 KB Output is correct
45 Correct 78 ms 190036 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 189868 KB Output is correct
2 Correct 74 ms 189776 KB Output is correct
3 Correct 74 ms 189840 KB Output is correct
4 Correct 80 ms 189936 KB Output is correct
5 Correct 73 ms 189860 KB Output is correct
6 Correct 75 ms 189884 KB Output is correct
7 Correct 77 ms 189776 KB Output is correct
8 Correct 74 ms 189820 KB Output is correct
9 Correct 75 ms 189776 KB Output is correct
10 Correct 76 ms 189776 KB Output is correct
11 Correct 73 ms 189772 KB Output is correct
12 Correct 74 ms 190036 KB Output is correct
13 Correct 81 ms 190032 KB Output is correct
14 Correct 79 ms 190024 KB Output is correct
15 Correct 79 ms 190032 KB Output is correct
16 Correct 80 ms 190032 KB Output is correct
17 Correct 88 ms 189988 KB Output is correct
18 Correct 85 ms 190248 KB Output is correct
19 Correct 97 ms 190292 KB Output is correct
20 Correct 72 ms 189780 KB Output is correct
21 Correct 71 ms 189824 KB Output is correct
22 Correct 76 ms 189776 KB Output is correct
23 Correct 72 ms 189920 KB Output is correct
24 Correct 69 ms 189776 KB Output is correct
25 Correct 73 ms 189776 KB Output is correct
26 Correct 74 ms 189888 KB Output is correct
27 Correct 84 ms 190036 KB Output is correct
28 Correct 77 ms 190036 KB Output is correct
29 Correct 85 ms 190204 KB Output is correct
30 Correct 98 ms 190272 KB Output is correct
31 Correct 100 ms 190288 KB Output is correct
32 Correct 102 ms 190544 KB Output is correct
33 Correct 120 ms 190476 KB Output is correct
34 Correct 74 ms 190032 KB Output is correct
35 Correct 149 ms 190600 KB Output is correct
36 Correct 79 ms 190036 KB Output is correct
37 Correct 76 ms 190036 KB Output is correct
38 Correct 76 ms 190036 KB Output is correct
39 Correct 79 ms 190036 KB Output is correct
40 Correct 76 ms 190008 KB Output is correct
41 Correct 73 ms 190036 KB Output is correct
42 Correct 76 ms 189840 KB Output is correct
43 Correct 75 ms 190036 KB Output is correct
44 Correct 75 ms 190000 KB Output is correct
45 Correct 78 ms 190036 KB Output is correct
46 Execution timed out 4040 ms 260176 KB Time limit exceeded
47 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 189868 KB Output is correct
2 Correct 74 ms 189776 KB Output is correct
3 Correct 74 ms 189840 KB Output is correct
4 Correct 80 ms 189936 KB Output is correct
5 Correct 73 ms 189860 KB Output is correct
6 Correct 75 ms 189884 KB Output is correct
7 Correct 77 ms 189776 KB Output is correct
8 Correct 74 ms 189820 KB Output is correct
9 Correct 75 ms 189776 KB Output is correct
10 Correct 76 ms 189776 KB Output is correct
11 Correct 73 ms 189772 KB Output is correct
12 Correct 74 ms 190036 KB Output is correct
13 Correct 81 ms 190032 KB Output is correct
14 Correct 79 ms 190024 KB Output is correct
15 Correct 79 ms 190032 KB Output is correct
16 Correct 80 ms 190032 KB Output is correct
17 Correct 88 ms 189988 KB Output is correct
18 Correct 85 ms 190248 KB Output is correct
19 Correct 97 ms 190292 KB Output is correct
20 Correct 72 ms 189780 KB Output is correct
21 Correct 71 ms 189824 KB Output is correct
22 Correct 76 ms 189776 KB Output is correct
23 Correct 72 ms 189920 KB Output is correct
24 Correct 69 ms 189776 KB Output is correct
25 Correct 73 ms 189776 KB Output is correct
26 Correct 74 ms 189888 KB Output is correct
27 Correct 84 ms 190036 KB Output is correct
28 Correct 77 ms 190036 KB Output is correct
29 Correct 85 ms 190204 KB Output is correct
30 Correct 98 ms 190272 KB Output is correct
31 Correct 100 ms 190288 KB Output is correct
32 Correct 102 ms 190544 KB Output is correct
33 Correct 120 ms 190476 KB Output is correct
34 Correct 74 ms 190032 KB Output is correct
35 Correct 149 ms 190600 KB Output is correct
36 Correct 79 ms 190036 KB Output is correct
37 Correct 76 ms 190036 KB Output is correct
38 Correct 76 ms 190036 KB Output is correct
39 Correct 79 ms 190036 KB Output is correct
40 Correct 76 ms 190008 KB Output is correct
41 Correct 73 ms 190036 KB Output is correct
42 Correct 76 ms 189840 KB Output is correct
43 Correct 75 ms 190036 KB Output is correct
44 Correct 75 ms 190000 KB Output is correct
45 Correct 78 ms 190036 KB Output is correct
46 Execution timed out 4040 ms 260176 KB Time limit exceeded
47 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 189868 KB Output is correct
2 Correct 74 ms 189776 KB Output is correct
3 Correct 74 ms 189840 KB Output is correct
4 Correct 80 ms 189936 KB Output is correct
5 Correct 73 ms 189860 KB Output is correct
6 Correct 75 ms 189884 KB Output is correct
7 Correct 77 ms 189776 KB Output is correct
8 Correct 74 ms 189820 KB Output is correct
9 Correct 75 ms 189776 KB Output is correct
10 Correct 76 ms 189776 KB Output is correct
11 Correct 73 ms 189772 KB Output is correct
12 Correct 74 ms 190036 KB Output is correct
13 Correct 81 ms 190032 KB Output is correct
14 Correct 79 ms 190024 KB Output is correct
15 Correct 79 ms 190032 KB Output is correct
16 Correct 80 ms 190032 KB Output is correct
17 Correct 88 ms 189988 KB Output is correct
18 Correct 85 ms 190248 KB Output is correct
19 Correct 97 ms 190292 KB Output is correct
20 Correct 72 ms 189780 KB Output is correct
21 Correct 71 ms 189824 KB Output is correct
22 Correct 76 ms 189776 KB Output is correct
23 Correct 72 ms 189920 KB Output is correct
24 Correct 69 ms 189776 KB Output is correct
25 Correct 73 ms 189776 KB Output is correct
26 Correct 74 ms 189888 KB Output is correct
27 Correct 84 ms 190036 KB Output is correct
28 Correct 77 ms 190036 KB Output is correct
29 Correct 85 ms 190204 KB Output is correct
30 Correct 98 ms 190272 KB Output is correct
31 Correct 100 ms 190288 KB Output is correct
32 Correct 102 ms 190544 KB Output is correct
33 Correct 120 ms 190476 KB Output is correct
34 Correct 74 ms 190032 KB Output is correct
35 Correct 149 ms 190600 KB Output is correct
36 Correct 79 ms 190036 KB Output is correct
37 Correct 76 ms 190036 KB Output is correct
38 Correct 76 ms 190036 KB Output is correct
39 Correct 79 ms 190036 KB Output is correct
40 Correct 76 ms 190008 KB Output is correct
41 Correct 73 ms 190036 KB Output is correct
42 Correct 76 ms 189840 KB Output is correct
43 Correct 75 ms 190036 KB Output is correct
44 Correct 75 ms 190000 KB Output is correct
45 Correct 78 ms 190036 KB Output is correct
46 Execution timed out 4040 ms 260176 KB Time limit exceeded
47 Halted 0 ms 0 KB -