This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <cmath>
#include <unordered_map>
#include <map>
#include <set>
#include <queue>
#include <vector>
#include <string>
#include <iomanip>
#include <algorithm>
#include "art.h"
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using namespace std;
typedef long long ll;
ll linf = 1e15+1;
inline void scoobydoobydoo(){
ios::sync_with_stdio(false);
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
}
//int realRating[9] = {1, 3, 5, 2, 4, 6, 9, 8, 7};
/*int publish(vector<int> R){
int sum = 0;
//for (int x : R)cout << x << " ";
//cout << endl;
for (int i = 0; i < R.size(); i++){
for (int j = i-1; j >= 0; j--){
if (realRating[R[i]-1] > realRating[R[j]-1]){
//cout << R[i] << " " << R[j] << " " << realRating[R[i]-1] << " " << realRating[R[j]-1] << endl;
sum++;
}
}
}
//cout << "SUM: " << sum << endl;
return sum;
}*/
/*void answer(vector<int> R){
}*/
vector<int> nV(vector<int> oldV){
vector<int> ret;
for (int i = 1; i < oldV.size(); i++){
ret.push_back(oldV[i]);
}
ret.push_back(oldV[0]);
return ret;
}
void solve(int N){
vector<int> start(N);
for (int i = 1; i <= N; i++)start[i-1] = i;
vector<pair<int, int> > v(N);
//cout << "hej" << endl;
int diffies[10000];
vector<pair<int, int>> diffs;
int last = publish(start);
//cout << "ej" << endl;
v[0] = {-1000, 0};
for (int i = 1; i < N; i++){
start = nV(start);
//cout << i << endl;
int w = publish(start);
diffies[w-last+2*N] = i;
diffs.push_back({w-last, i-1});
last = w;
}
/*for (auto p : diffs){
cout << p.first << " " << p.second << endl;
}*/
vector<int> ans;
for (int i = 1+N; i <= 2*N+N; i+=2){
if (diffies[i])ans.push_back(diffies[i]);
else ans.push_back(N);
}
reverse(all(ans));
answer(ans);
//for (int i = 0; i < ans.size(); i++)cout << ans[i] << " ";
//cout << endl;
}
/*int main(){
scoobydoobydoo();
solve(9);
return 0;
}*/
Compilation message (stderr)
art.cpp: In function 'std::vector<int> nV(std::vector<int>)':
art.cpp:53:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
53 | for (int i = 1; i < oldV.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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |