Submission #139337

#TimeUsernameProblemLanguageResultExecution timeMemory
139337wilwxkMechanical Doll (IOI18_doll)C++14
Compilation error
0 ms0 KiB
#include "doll.h" #include <bits/stdc++.h> using namespace std; const int MAXN=2e5+5; map<int, int> mp; int faz[MAXN*2]; vector<int> c, x, y, quero; int n, m, cont; void debug() { for(auto cur : c) printf("%d ", cur); cout << endl; for(auto cur : x) printf("%d ", cur); cout << endl; for(auto cur : y) printf("%d ", cur); cout << endl; } void decompoe(int val) { mp[1]=val; int cur=1; while(1) { int qtd=mp[cur]-2; if(qtd<=0) break; mp[cur*2]+=qtd/2; mp[cur]-=(qtd/2)*2; cur*=2; } for(auto mit : mp) for(int i=0; i<mit.second; i++) quero.push_back(mit.first); // for(auto cur : quero) printf("%d ", cur); // printf("vla3\n"); } void create_circuit(int M, std::vector<int> A) { n=A.size(); m=M; if(n==1) { c.push_back(1); c.push_back(0); answer(c, x, y); return 0; } decompoe(n); c.push_back(1); c.push_back(--cont); int ult=1; for(int i=1; i<quero.size(); i++) { // printf("%d cuida do %d\n", cont, quero[i]); if(quero[i]!=quero[i-1]) { if(cont+2==0) x.push_back(1); else x.push_back(cont+2); y.push_back(cont-1); } else { if(cont+1==0) x.push_back(1); else x.push_back(cont+1); y.push_back(cont-1); } cont--; } y.back()=0; // debug(); answer(c, x, y); }

Compilation message (stderr)

doll.cpp: In function 'void debug()':
doll.cpp:12:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   12 |   for(auto cur : c) printf("%d ", cur); cout << endl;
      |   ^~~
doll.cpp:12:41: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   12 |   for(auto cur : c) printf("%d ", cur); cout << endl;
      |                                         ^~~~
doll.cpp:13:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   13 |   for(auto cur : x) printf("%d ", cur); cout << endl;
      |   ^~~
doll.cpp:13:41: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   13 |   for(auto cur : x) printf("%d ", cur); cout << endl;
      |                                         ^~~~
doll.cpp:14:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   14 |   for(auto cur : y) printf("%d ", cur); cout << endl;
      |   ^~~
doll.cpp:14:41: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   14 |   for(auto cur : y) printf("%d ", cur); cout << endl;
      |                                         ^~~~
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:39:12: error: return-statement with a value, in function returning 'void' [-fpermissive]
   39 |     return 0;
      |            ^
doll.cpp:47:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |   for(int i=1; i<quero.size(); i++) {
      |                ~^~~~~~~~~~~~~
doll.cpp:46:7: warning: unused variable 'ult' [-Wunused-variable]
   46 |   int ult=1;
      |       ^~~