Submission #75264

#TimeUsernameProblemLanguageResultExecution timeMemory
75264KieranHorganMechanical Doll (IOI18_doll)C++17
0 / 100
1 ms204 KiB
#include "doll.h" #include <bits/stdc++.h> using namespace std; pair<int, int> exits[400005]; vector<int> X, Y; int nodeIdx = 1; void build(vector<int> cur) { int curNode = nodeIdx++; if(cur.size() == 1) { if(cur[0] < 0) { if(cur[0] == -(1<<30)) cur[0] = 1; exits[curNode] = {-cur[0], 0}; return; } if(cur[0] == (1<<30)) cur[0] = -1; exits[curNode] = {cur[0], -1}; return; } vector<int> nextCur; for(int i = 0; i < cur.size(); i+=2) { nextCur.push_back(cur[i]); } build(nextCur); nextCur.clear(); exits[curNode] = {-(curNode+1), -(nodeIdx)}; for(int i = 1; i < cur.size(); i+=2) { nextCur.push_back(cur[i]); } build(nextCur); nextCur.clear(); } void create_circuit(int M, vector<int> A) { // int N = A.size(); // while(__builtin_popcount(A.size()) != 1) { // A.push_back(1<<30); // } vector<int> C(M + 1); C[0] = -1; for (int i = 1; i <= M; ++i) { C[i] = -1; } vector<int> cur; for(int i = 0; i < A.size(); i++) { cur.push_back(A[i]); } cur.back() = -cur.back(); build(cur); for(int i = 1; i < nodeIdx; i++) { X.push_back(exits[i].first); Y.push_back(exits[i].second); // cerr << i << ": " << X.back() << " " << Y.back() << endl; } // cerr << N << " -> " << X.size() << " (" << N + log2(N) << ")" << endl; // double score; // if(X.size() <= N + log2(N)) score = 100; // else if(X.size() > 2*N) score = 0; // else score = 100*(0.5 + 0.4 * ( (2*N - X.size()) / (N - log2(N)) ) * ( (2*N - X.size()) / (N - log2(N)) )); // cerr << "Score: " << score << endl; answer(C, X, Y); }

Compilation message (stderr)

doll.cpp: In function 'void build(std::vector<int>)':
doll.cpp:22:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |   for(int i = 0; i < cur.size(); i+=2) {
      |                  ~~^~~~~~~~~~~~
doll.cpp:29:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |   for(int i = 1; i < cur.size(); i+=2) {
      |                  ~~^~~~~~~~~~~~
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:48:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |   for(int i = 0; i < A.size(); i++) {
      |                  ~~^~~~~~~~~~
#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...