Submission #963826

#TimeUsernameProblemLanguageResultExecution timeMemory
963826marinalucaDetecting Molecules (IOI16_molecules)C++17
9 / 100
1 ms356 KiB
#include <bits/stdc++.h> //#include <ext/pb_ds/assoc_container.hpp> /**#pragma GCC optimize ("O4") #pragma GCC optimize ("fast-math") #pragma GCC optimize ("unroll-loops") #define int long long #define ll long long #define XX first #define YY second #define pb push_back #define sz (x) int(x.size()) #define pf pop_front #define pob pop_back #define pff push_front **/ using namespace std; #include "molecules.h" /** typedef ldb long double; typedef vii vector <int>; typedef pid pair <double, double>; typedef pii pair <int, int>; typedef ull unsigned long long; **/ vector <int> find_subset (const int l, const int u,const vector <int> w){ vector < pair <long long, long long>> ans; vector <int> v; for (long long i = 0; i < w.size(); ++ i){ ans.push_back({w[i], i}); } sort (ans.begin(), ans.end()); for (long long i = 0, sum = 0, cnt = 0; i < w.size(); ++ i){ sum += ans[i].first; while (sum > u){ sum -= ans[i].first; ++ cnt; } if (sum >= l){ for (long long idx = cnt; idx <= i; ++ idx){ v.push_back(ans[idx].second); } break; } } return v; } /** signed main(void){ ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); return 0 ^ 0; } **/

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:31:29: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |     for (long long i = 0; i < w.size(); ++ i){
      |                           ~~^~~~~~~~~~
molecules.cpp:35:47: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |     for (long long i = 0, sum = 0, cnt = 0; i < w.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...