Submission #970628

#TimeUsernameProblemLanguageResultExecution timeMemory
970628kl0989eArt Collections (BOI22_art)C++17
100 / 100
1051 ms1708 KiB
#include <bits/stdc++.h>
#include "art.h"
using namespace std;

#define ll long long
#define fi first
#define se second
#define pb push_back
#define vi vector<int>
#define pi pair<int, int>
#define all(x) (x).begin(),(x).end()

void move(vi& nums) {
    int temp=nums[0];
    for (int i=1; i<nums.size(); i++) {
        nums[i-1]=nums[i];
    }
    nums.back()=temp;
}

void solve(int n) {
    srand(time(0));
    vi nums(n);
    iota(all(nums),1);
    vi ans(n,n);
    ll last=publish(nums);
    for (int i=0; i<n-1; i++) {
        move(nums);
        ll nw=publish(nums);
        ans[last-(last+nw-n+1)/2]=nums.back();
        last=nw;
    }
    answer(ans);
}

Compilation message (stderr)

art.cpp: In function 'void move(std::vector<int>&)':
art.cpp:15:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for (int i=1; i<nums.size(); i++) {
      |                   ~^~~~~~~~~~~~
interface.cpp: In function 'int publish(std::vector<int>)':
interface.cpp:20:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
interface.cpp: In function 'void answer(std::vector<int>)':
interface.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...