Submission #1172099

#TimeUsernameProblemLanguageResultExecution timeMemory
1172099nguyenkhangninh99Detecting Molecules (IOI16_molecules)C++20
100 / 100
37 ms4280 KiB
#include <bits/stdc++.h> #include "molecules.h" using namespace std; #define ll long long vector<int> find_subset(int l, int u, vector<int> w){ queue<int> q; vector<int> res; vector<array<int, 2>> a; ll cur = 0; for (int i = 0; i < w.size(); i++) a.push_back({w[i], i}); sort(a.begin(), a.end()); for (int i = 0; i < w.size(); i++){ cur += a[i][0]; q.push(a[i][1]); if(cur > u){ cur -= w[q.front()]; q.pop(); } if(l <= cur && cur <= u){ while (!q.empty()){ res.push_back(q.front()); q.pop(); } break; } } return res; }

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...