Submission #578286

#TimeUsernameProblemLanguageResultExecution timeMemory
578286Theo830Mechanical Doll (IOI18_doll)C++17
0 / 100
1 ms340 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; ll INF = 1e18+7; ll MOD = 998244353; typedef pair<ll,ll> ii; #define iii pair<ll,ii> #define f(i,a,b) for(ll i = a;i < b;i++) #define pb push_back #define vll vector<ll> #define F first #define S second #define all(x) (x).begin(), (x).end() ///I hope I will get uprating and don't make mistakes ///I will never stop programming ///sqrt(-1) Love C++ ///Please don't hack me ///@TheofanisOrfanou Theo830 ///Think different approaches (bs,dp,greedy,graphs,shortest paths,mst) ///Stay Calm ///Look for special cases ///Beware of overflow and array bounds ///Think the problem backwards ///Training #include "doll.h" vector<int> X,Y,C; ll pos = 1; void solve(ll s,vll arr){ if(arr.size() == 1){ X[s - 1] = Y[s - 1] = arr[0]; return; } vll exo[2]; f(i,0,arr.size()){ exo[i % 2].pb(arr[i]); } if(arr.size() % 2){ exo[1].pb(exo[0].back()); exo[0].back() = -s; } X[s - 1] = -pos; Y[s - 1] = -(pos + 1); pos += 2; solve(-X[s - 1],exo[0]); solve(-Y[s - 1],exo[1]); } void create_circuit(int M, std::vector<int> A) { int n = A.size(); f(i,0,M+1){ C.pb(0); } C[0] = A[0]; vll mp[M+5]; set<ll>ex; A.pb(0); f(i,0,n){ mp[A[i]].pb(A[i+1]); } set<ll>ev; f(i,0,n){ if(ev.count(A[i])){ continue; } ev.insert(A[i]); C[A[i]] = pos; pos++; solve(pos - 1,mp[A[i]]); } answer(C, X, Y); }

Compilation message (stderr)

doll.cpp: In function 'void solve(ll, std::vector<long long int>)':
doll.cpp:8:33: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    8 | #define f(i,a,b) for(ll i = a;i < b;i++)
......
   34 |     f(i,0,arr.size()){
      |       ~~~~~~~~~~~~~~             
doll.cpp:34:5: note: in expansion of macro 'f'
   34 |     f(i,0,arr.size()){
      |     ^
#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...