답안 #633972

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
633972 2022-08-23T14:42:31 Z Olympia Sob (COCI19_sob) C++17
110 / 110
123 ms 80300 KB
#include <bits/stdc++.h>
 
using namespace std;

void rec (vector<pair<int,int> > v1, vector<pair<int,int> > v2) {
    for (int len = 1; len <= v1.size(); len++) {
        bool fine = true;
        vector<pair<int,int> > res;
        for (int i = 0; i < len; i++) {
            int x1 = v1[v1.size() - len + i].first;
            int x2 = v2[i].first;
            res.push_back(make_pair(x1, x2));
            if ((x1 & x2) != x1) {
                fine = false;
                break;
            }
        }
        if (fine) {
            for (auto& p: res) {
                cout << p.first << " " << p.second << '\n';
            }
            int l = len;
            reverse(v2.begin(), v2.end());
            while (l--) {
                v1.pop_back();
                v2.pop_back();
            }
            reverse(v2.begin(), v2.end());
            rec(v1, v2);
            return;
        }
    }
}

int main () {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int N, M;
    cin >> N >> M;
    vector<pair<int,int> > v1, v2;
    v1.resize(N), v2.resize(N);
    for (int i = 0; i < N; i++) {
        v1[i].first = v1[i].second = i, v2[i].first = v2[i].second = i + M;
    }
    rec(v1, v2);

}

Compilation message

sob.cpp: In function 'void rec(std::vector<std::pair<int, int> >, std::vector<std::pair<int, int> >)':
sob.cpp:6:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    6 |     for (int len = 1; len <= v1.size(); len++) {
      |                       ~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 316 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 50 ms 17576 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 468 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 324 KB Output is correct
6 Correct 50 ms 14304 KB Output is correct
7 Correct 25 ms 7120 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 320 KB Output is correct
2 Correct 1 ms 316 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 1 ms 320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 316 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 50 ms 17576 KB Output is correct
5 Correct 1 ms 468 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 324 KB Output is correct
10 Correct 50 ms 14304 KB Output is correct
11 Correct 25 ms 7120 KB Output is correct
12 Correct 0 ms 320 KB Output is correct
13 Correct 1 ms 316 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Correct 0 ms 340 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 340 KB Output is correct
18 Correct 1 ms 320 KB Output is correct
19 Correct 11 ms 3924 KB Output is correct
20 Correct 50 ms 33740 KB Output is correct
21 Correct 4 ms 980 KB Output is correct
22 Correct 1 ms 724 KB Output is correct
23 Correct 71 ms 51888 KB Output is correct
24 Correct 120 ms 73328 KB Output is correct
25 Correct 123 ms 80300 KB Output is correct