Submission #1132203

#TimeUsernameProblemLanguageResultExecution timeMemory
1132203lopkusDetecting Molecules (IOI16_molecules)C++20
0 / 100
0 ms324 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; std::vector<int> find_subset(int l, int u, std::vector<int> w) { vector<pair<int,int>> V; int n = w.size(); for(int i = 0; i < n; i++) { V.push_back({w[i], i}); } sort(V.begin(), V.end()); int i = 0, j = 0; int x = 0; while(i < n && j < n) { if(x >= l && x <= u) { break; } if(x < l && j < n - 1) { if(j + 1 == n) { break; } x += V[++j].first; } else { x -= V[i++].first; } } vector<int> ans; if(x >= l && x <= u) { for(int q = i; q <= j; q++) { ans.push_back(V[q].second); } } sort(ans.begin(), ans.end()); return ans; }

Compilation message (stderr)

molecules.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
molecules_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#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...