답안 #583348

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
583348 2022-06-25T09:11:13 Z WongChun1234 The Collection Game (BOI21_swaps) C++14
0 / 100
64 ms 472 KB
//
// --- Sample implementation for the task swaps ---
//
// To compile this program with the sample grader, place:
//     swaps.h swaps_sample.cpp sample_grader.cpp
// in a single folder and run:
//     g++ swaps_sample.cpp sample_grader.cpp
// in this folder.
//
#include "swaps.h"
#include<bits/stdc++.h>
using namespace std;
const int N=550;
int rrl[N];
vector<pair<int,int>> sch;

void solve(int n, int v) {
    // TODO implement this function
    for (int i=1;i<=n;i++) rrl[i]=i;
    for (int i=2;i<=n;i++){
    	for (int j=(i%2)+1;j<n;j+=2){
    		schedule(rrl[j],rrl[j+1]);
    		sch.push_back({rrl[j],rrl[j+1]});
		}
		vector<int> res=visit();
		for (int j=0,pos=(i%2)+1;j<res.size();j++,pos+=2){
			if (res[j]){
				//frnt < back, 60% must
				//rrl[j] now has smaller one
			}else{
				//rrl[j] has bigger one
				swap(rrl[pos],rrl[pos+1]);
			}
		}
		sch.clear();
	}
    /*for (int i=n-1;i>=2;i--){
    	for (int j=(i%2)+1;j<i;j+=2){
    		schedule(rrl[j],rrl[j+1]);
    		sch.push_back({rrl[j],rrl[j+1]});
		}
		vector<int> res=visit();
		for (int j=0,pos=(i%2)+1;j<res.size();j++,pos+=2){
			if (res[j]){
				//frnt < back, 60% must
				//rrl[j] now has smaller one
			}else{
				//rrl[j] has bigger one
				swap(rrl[pos],rrl[pos+1]);
			}
		}
		sch.clear();
	}*/
	vector<int> ans(n);
	for (int i=1;i<=n;i++) ans[i-1]=rrl[i];
	answer(ans);
}

Compilation message

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:26:29: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |   for (int j=0,pos=(i%2)+1;j<res.size();j++,pos+=2){
      |                            ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 208 KB Correct
2 Correct 3 ms 308 KB Correct
3 Correct 12 ms 208 KB Correct
4 Correct 50 ms 472 KB Correct
5 Correct 60 ms 304 KB Correct
6 Incorrect 44 ms 308 KB Not correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Correct
2 Correct 3 ms 208 KB Correct
3 Correct 17 ms 208 KB Correct
4 Correct 47 ms 304 KB Correct
5 Correct 64 ms 304 KB Correct
6 Incorrect 42 ms 308 KB Not correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 208 KB Not correct
2 Halted 0 ms 0 KB -