Submission #481219

#TimeUsernameProblemLanguageResultExecution timeMemory
481219glomeDetecting Molecules (IOI16_molecules)C++17
31 / 100
1090 ms27204 KiB
#pragma GCC target ("avx2") #pragma GCC optimization ("O3") #pragma GCC optimization ("unroll-loops") #include "molecules.h" #include<bits/stdc++.h> using namespace std; struct S { int b = 0; vector<int> ind; }; std::vector<int> find_subset(int l, int u, std::vector<int> w) { int s = 0; for (int i : w) { s += i; } if(s == w.size()) { if(l > w.size()) { return vector<int> (0); } vector<int> ans; for (int i = 0; i<l; i++) { ans.push_back(i); } return ans; } vector<S> ok(10000+1); 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].ind = ok[j-i].ind; ok[j].b = 1; (ok[j].ind).push_back(cnt); } } cnt++; } vector<int> ans; for (int i = l; i<=u; i++) { if(i > s) { break; } if(ok[i].b) { return ok[i].ind; } } 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 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:21:9: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |    if(s == w.size()) {
      |       ~~^~~~~~~~~~~
molecules.cpp:22:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |       if(l > w.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...