답안 #639943

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
639943 2022-09-12T18:38:34 Z jasmin The Collection Game (BOI21_swaps) C++14
21 / 100
420 ms 556 KB
#include <swaps.h>
#include <algorithm>
#include <functional>
#include <vector>
#include <iostream>
using namespace std;


/*void schedule(int i, int j){
    cout << "schedule " << i << " " << j << "\n";
}

vector<int> visit(){
    cout << "visit\n";
    int n;
    cin >> n;
    vector<int> ans(n);
    for(int i=0; i<n; i++){
        cin >> ans[i];
    }
    return ans;
}

void answer(vector<int>& ans){
    cout << "answer: \n";
    for(auto e: ans){
        cout << e << " ";
    }
    cout << "\n";
}*/

void solve(int n, int v){
    vector<int> a(n);
    for(int i=0; i<n; i++){
        a[i]=i+1;
    }

    for(int i=0; i<v; i++){
        if(i%2==0){
            for(int j=0; j+1<n; j+=2){
                schedule(j+1, j+2);
            }
            vector<int> resp=visit();
            for(int j=0; j+1<n; j+=2){
                if(resp[j/2]==0) swap(a[j], a[j+1]);
            }
        }
        else{
            for(int j=1; j+1<n; j+=2){
                schedule(j+1, j+2);
            }
            vector<int> resp=visit();
            for(int j=1; j+1<n; j+=2){
                if(resp[j/2]==0) swap(a[j], a[j+1]);
            }
        }
    }

    answer(a);
}

/*signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n, v;
    cin >> n >> v;
    solve(n, v);
}*/
# 결과 실행 시간 메모리 Grader output
1 Incorrect 51 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 52 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 208 KB Correct
2 Correct 104 ms 208 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 208 KB Correct
2 Correct 104 ms 208 KB Correct
3 Incorrect 41 ms 208 KB Not correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 208 KB Correct
2 Correct 103 ms 208 KB Correct
3 Correct 203 ms 276 KB Correct
4 Correct 379 ms 556 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 208 KB Correct
2 Correct 103 ms 208 KB Correct
3 Correct 203 ms 276 KB Correct
4 Correct 379 ms 556 KB Correct
5 Incorrect 46 ms 208 KB Not correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 208 KB Correct
2 Correct 112 ms 208 KB Correct
3 Correct 214 ms 280 KB Correct
4 Correct 374 ms 492 KB Correct
5 Correct 40 ms 376 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 208 KB Correct
2 Correct 112 ms 208 KB Correct
3 Correct 214 ms 280 KB Correct
4 Correct 374 ms 492 KB Correct
5 Correct 40 ms 376 KB Correct
6 Incorrect 55 ms 208 KB Not correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 208 KB Correct
2 Correct 110 ms 208 KB Correct
3 Correct 203 ms 276 KB Correct
4 Correct 386 ms 408 KB Correct
5 Correct 37 ms 280 KB Correct
6 Incorrect 10 ms 280 KB Not correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 208 KB Correct
2 Correct 110 ms 208 KB Correct
3 Correct 203 ms 276 KB Correct
4 Correct 386 ms 408 KB Correct
5 Correct 37 ms 280 KB Correct
6 Incorrect 10 ms 280 KB Not correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 208 KB Correct
2 Correct 109 ms 208 KB Correct
3 Correct 228 ms 280 KB Correct
4 Correct 420 ms 480 KB Correct
5 Correct 39 ms 300 KB Correct
6 Incorrect 7 ms 280 KB Not correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 42 ms 208 KB Correct
2 Correct 109 ms 208 KB Correct
3 Correct 228 ms 280 KB Correct
4 Correct 420 ms 480 KB Correct
5 Correct 39 ms 300 KB Correct
6 Incorrect 7 ms 280 KB Not correct
7 Halted 0 ms 0 KB -