Submission #959754

# Submission time Handle Problem Language Result Execution time Memory
959754 2024-04-09T03:35:47 Z josanneo22 The Collection Game (BOI21_swaps) C++17
3 / 100
32 ms 436 KB
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;

#define L(i,j,k) for(int i=(j);i<=(k);++i)
#define R(i,j,k) for(int i=(j);i>=(k);--i)
#define rep(i, n) L(i, 1, n)
#define all(x) x.begin(),x.end()
#define me(x,a) memset(x,a,sizeof(x))

#include<random>
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
      
#include "swaps.h"

const int nax = 105;
int a[nax];

void solve(int N, int V) {
	L(i, 1, N) a[i] = i;
	L(i, 1, N) L(j, i + 1, N) {
		schedule(i, j);
		vector<int> res = visit();
		if (res[0] == 0) swap(a[i], a[j]);
	}
	vector<int> ans;
	L(i, 1, N) ans.push_back(a[i]);
	answer(ans);
	return;
}




//~ #include <cstdarg>
//~ #include <cstdio>
//~ #include <cstdlib>
//~ #include <set>
//~ #include <vector>

//~ using namespace std;

//~ void __attribute__((noreturn)) __attribute__((format(printf, 1, 2))) result(const char *msg, ...) {
    //~ va_list args;
    //~ va_start(args, msg);
    //~ vfprintf(stderr, msg, args);
    //~ fprintf(stderr, "\n");
    //~ va_end(args);
    //~ exit(0);
//~ }

//~ namespace {
    //~ int N, V, visits;
    //~ set<int> queryIndices;
    //~ vector<int> A, queryResult;
//~ }

//~ void schedule(int i, int j) {
    //~ printf("schedule(%d, %d)\n", i, j);
    //~ fflush(stdout);

    //~ if (i < 1 || i > N || j < 1 || j > N || i == j)
        //~ result("Invalid schedule");
    //~ if (queryIndices.find(i) != queryIndices.end() || queryIndices.find(j) != queryIndices.end())
        //~ result("Invalid schedule");
    //~ queryIndices.insert(i);
    //~ queryIndices.insert(j);

    //~ int s;
    //~ if (scanf("%d", &s) != 1 || (s != 0 && s != 1))
        //~ result("Invalid input");
    //~ if (s)
        //~ swap(A[i], A[j]);
    //~ queryResult.push_back(A[i] < A[j]);
//~ }

//~ vector<int> visit() {
    //~ printf("visit(): {");
    //~ for (int i = 0; i < (int)queryResult.size(); i++) {
        //~ printf("%d", queryResult[i]);
        //~ if (i + 1 != (int)queryResult.size())
            //~ printf(", ");
    //~ }
    //~ printf("}\n");
    //~ fflush(stdout);

    //~ visits++;
    //~ if (visits > V)
        //~ result("Out of visits");

    //~ vector<int> res = queryResult;
    //~ queryIndices.clear();
    //~ queryResult.clear();
    //~ return res;
//~ }

//~ void answer(vector<int> r) {
    //~ printf("answer({");
    //~ for (int i = 0; i < (int)r.size(); i++) {
        //~ printf("%d", r[i]);
        //~ if (i + 1 != (int)r.size())
            //~ printf(", ");
    //~ }
    //~ printf("})\n");

    //~ if ((int)r.size() != N)
        //~ result("Invalid answer");

    //~ for (int i = 0; i < N; i++) {
        //~ if (r[i] < 1 || r[i] > N)
            //~ result("Invalid answer");
        //~ if (A[r[i]] != i + 1)
            //~ result("Wrong answer");
    //~ }

    //~ result("Correct: %d visit(s) used", visits);
//~ }

//~ const int nax = 105;
//~ int a[nax];

//~ void solve(int N, int V) {
	//~ L(i, 1, N) a[i] = i;
	//~ L(i, 1, N) L(j, i + 1, N) {
		//~ schedule(i, j);
		//~ vector<int> res = visit();
		//~ if (res[0] == 1) swap(a[i], a[j]);
	//~ }
	//~ vector<int> ans;
	//~ L(i, 1, N) ans.push_back(a[i]);
	//~ answer(ans);
	//~ return;
//~ }



//~ int main() {
    //~ if (scanf("%d %d", &N, &V) != 2 || N < 1 || V < 0)
        //~ result("Invalid input");

    //~ A.resize(N + 1);
    //~ for (int i = 1; i <= N; i++) {
        //~ int x;
        //~ if (scanf("%d", &x) != 1 || x < 1 || x > N || A[x])
            //~ result("Invalid input");
        //~ A[x] = i;
    //~ }

    //~ solve(N, V);

    //~ result("No answer");
//~ }

# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 32 ms 344 KB Correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 32 ms 344 KB Correct
3 Incorrect 1 ms 344 KB Not correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 23 ms 344 KB Correct
3 Runtime error 23 ms 420 KB Execution killed with signal 13
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 23 ms 344 KB Correct
3 Runtime error 23 ms 420 KB Execution killed with signal 13
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 23 ms 344 KB Correct
3 Runtime error 25 ms 424 KB Execution killed with signal 13
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 23 ms 344 KB Correct
3 Runtime error 25 ms 424 KB Execution killed with signal 13
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 25 ms 344 KB Correct
3 Runtime error 22 ms 436 KB Execution killed with signal 13
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 25 ms 344 KB Correct
3 Runtime error 22 ms 436 KB Execution killed with signal 13
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 24 ms 344 KB Correct
3 Runtime error 28 ms 420 KB Execution killed with signal 13
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Correct
2 Correct 24 ms 344 KB Correct
3 Runtime error 28 ms 420 KB Execution killed with signal 13
4 Halted 0 ms 0 KB -