Submission #812696

#TimeUsernameProblemLanguageResultExecution timeMemory
812696elotelo966Detecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include "molecules.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; std::vector<int> find_subset(int l, int u, std::vector<int> w){ vector <pair<ll,ll>> dizi; ll n=w.size(); for(ll i=0;i<n;i++){ dizi.push_back({w[i],i}); } sort(dizi.begin(),dizi.end()); ll le=0,r=0,sum=0; bool stop=false; while(le<=r && r<n){ if(sum+dizi[r].first<l){ sum+=dizi[r].first; r++; } else if(sum+dizi[r].first>=l && sum+dizi[r].first<=u){ stop=true; break; } else{ sum-=dizi[le].first; le++; } } vector <ll> cev; if(stop){ for(int i=le;i<=r;i++){ cev.push_back(ger[i].second); } sort(cev.begin(),cev.end()); } return cev; }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:33:23: error: 'ger' was not declared in this scope
   33 |         cev.push_back(ger[i].second);
      |                       ^~~
molecules.cpp:37:12: error: could not convert 'cev' from 'vector<long long int>' to 'vector<int>'
   37 |     return cev;
      |            ^~~
      |            |
      |            vector<long long int>