Submission #481227

#TimeUsernameProblemLanguageResultExecution timeMemory
481227glomeDetecting Molecules (IOI16_molecules)C++17
46 / 100
164 ms1624 KiB
#pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #include "molecules.h" #include<bits/stdc++.h> using namespace std; vector<int> ans; vector<vector<int>> need(1e4 + 1); struct S { int b = 0; vector<int> ind; }; vector<S> ok(1e4 + 1); void dfs(int a) { if(a == 0) { return; } for (int i = 0; i<ok[a].ind.size(); i++) { ans.push_back(ok[a].ind[i]); } for (int u : need[a]) { dfs(u); } } std::vector<int> find_subset(int l, int u, std::vector<int> w) { ok[0].b = 1; int cnt = 0; for (int i : w) { for (int j = u; j>=i; j--) { if(ok[j-i].b && !ok[j].b) { need[j].push_back(j-i); ok[j].b = 1; (ok[j].ind).push_back(cnt); } } cnt++; } for (int i = l; i<=u; i++) { if(ok[i].b) { dfs(i); return ans; } } return ans; }

Compilation message (stderr)

molecules.cpp:2: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    2 | #pragma GCC optimization ("O3")
      | 
molecules.cpp:3: warning: ignoring '#pragma GCC optimization' [-Wunknown-pragmas]
    3 | #pragma GCC optimization ("unroll-loops")
      | 
molecules.cpp: In function 'void dfs(int)':
molecules.cpp:29:19: 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 = 0; i<ok[a].ind.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...