답안 #426263

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
426263 2021-06-13T16:16:34 Z duality The Collection Game (BOI21_swaps) C++14
5 / 100
72 ms 424 KB
#include <bits/stdc++.h>
using namespace std;
#define mp make_pair
#define pb push_back
typedef long long int LLI;
typedef vector<int> vi;
typedef pair<int,int> pii;
typedef vector<pii> vpii;
#include "swaps.h"

int used[500];
void solve(int N,int V) {
    int i,j;
    vi order;
    for (i = 0; i < N; i++) order.pb(i+1);
    int s = sqrt(N);
    for (j = 0; j < 125; j++) {
        vi v1,v2;
        for (i = s; i < N; i++) {
            if (!used[i-s]) v1.pb(i),schedule(order[i-s],order[i]),used[i-s] = used[i] = 1;
            else v2.pb(i);
        }
        fill(used,used+N,0);
        vi r = visit();
        for (i = 0; i < r.size(); i++) {
            if (!r[i]) swap(order[v1[i]-s],order[v1[i]]);
        }
        for (i = 0; i < v2.size(); i++) schedule(order[v2[i]-s],order[v2[i]]);
        r = visit();
        for (i = 0; i < r.size(); i++) {
            if (!r[i]) swap(order[v2[i]-s],order[v2[i]]);
        }
        v1.clear(),v2.clear();
        for (i = 1; i < N; i++) {
            if (i & 1) schedule(order[i-1],order[i]),v1.pb(i);
            else v2.pb(i);
        }
        r = visit();
        for (i = 0; i < r.size(); i++) {
            if (!r[i]) swap(order[v1[i]-1],order[v1[i]]);
        }
        for (i = 0; i < v2.size(); i++) schedule(order[v2[i]-1],order[v2[i]]);
        r = visit();
        for (i = 0; i < r.size(); i++) {
            if (!r[i]) swap(order[v2[i]-1],order[v2[i]]);
        }
    }
    answer(order);
}

Compilation message

swaps.cpp: In function 'void solve(int, int)':
swaps.cpp:25:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |         for (i = 0; i < r.size(); i++) {
      |                     ~~^~~~~~~~~~
swaps.cpp:28:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |         for (i = 0; i < v2.size(); i++) schedule(order[v2[i]-s],order[v2[i]]);
      |                     ~~^~~~~~~~~~~
swaps.cpp:30:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |         for (i = 0; i < r.size(); i++) {
      |                     ~~^~~~~~~~~~
swaps.cpp:39:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         for (i = 0; i < r.size(); i++) {
      |                     ~~^~~~~~~~~~
swaps.cpp:42:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |         for (i = 0; i < v2.size(); i++) schedule(order[v2[i]-1],order[v2[i]]);
      |                     ~~^~~~~~~~~~~
swaps.cpp:44:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   44 |         for (i = 0; i < r.size(); i++) {
      |                     ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 200 KB Correct
2 Correct 15 ms 200 KB Correct
3 Correct 35 ms 280 KB Correct
4 Correct 69 ms 300 KB Correct
5 Correct 57 ms 308 KB Correct
6 Incorrect 56 ms 304 KB Not correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 200 KB Correct
2 Correct 18 ms 200 KB Correct
3 Correct 37 ms 284 KB Correct
4 Correct 71 ms 304 KB Correct
5 Correct 55 ms 308 KB Correct
6 Incorrect 72 ms 304 KB Not correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 200 KB Correct
2 Correct 17 ms 200 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 200 KB Correct
2 Correct 17 ms 200 KB Correct
3 Correct 8 ms 200 KB Correct
4 Correct 17 ms 200 KB Correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 200 KB Correct
2 Correct 18 ms 200 KB Correct
3 Correct 33 ms 200 KB Correct
4 Incorrect 55 ms 424 KB Not correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 200 KB Correct
2 Correct 18 ms 200 KB Correct
3 Correct 33 ms 200 KB Correct
4 Incorrect 55 ms 424 KB Not correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 200 KB Correct
2 Correct 21 ms 200 KB Correct
3 Correct 32 ms 276 KB Correct
4 Incorrect 58 ms 300 KB Not correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 200 KB Correct
2 Correct 21 ms 200 KB Correct
3 Correct 32 ms 276 KB Correct
4 Incorrect 58 ms 300 KB Not correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 212 KB Correct
2 Correct 19 ms 200 KB Correct
3 Correct 37 ms 292 KB Correct
4 Incorrect 57 ms 404 KB Not correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 212 KB Correct
2 Correct 19 ms 200 KB Correct
3 Correct 37 ms 292 KB Correct
4 Incorrect 57 ms 404 KB Not correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 200 KB Correct
2 Correct 23 ms 200 KB Correct
3 Correct 27 ms 276 KB Correct
4 Incorrect 56 ms 304 KB Not correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 200 KB Correct
2 Correct 23 ms 200 KB Correct
3 Correct 27 ms 276 KB Correct
4 Incorrect 56 ms 304 KB Not correct
5 Halted 0 ms 0 KB -