Submission #972719

#TimeUsernameProblemLanguageResultExecution timeMemory
972719vjudge1Detecting Molecules (IOI16_molecules)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include <sstream> #include "molecules.h" using namespace std; #define accepted ios_base::sync_with_stdio(false);cin.tie(nullptr); #define Daulbekov signed #define Makan main #define int long long #define double long double #define pb push_back #define pf push_front #define F first #define S second const int N=2e5+7; const int MAX=9e18+7; const int INF=1e18; vector<int>find_subset(int l,int u,vector<int>w){ pair<int,int>w1[w.size()+1]; for(int i=0;i<w.size();i++){ w1[i].F=w[i]; w1[i].S=i; } sort(w1.begin(),w1.end()); int l1=0,r1=0,sum=w1[0].F; vector<int>ans; while(l1<n&&r1<n){ if(l<=sum&&sum<=u){ for(int i=l1;i<=r1;i++)ans.pb(w1[i].S); break; } else if(l>sum){ r1++; sum+=w1[r1].F; } else if(sum>u){ sum-=w1[l1].F; l++; } } return ans; } //Daulbekov Makan(){ // accepted; // //} // 2 2 4 // 2 2 2 // 3 2 1 3 2 1 3 3 // 3 2 1 3 2 1

Compilation message (stderr)

molecules.cpp: In function 'std::vector<long long int> find_subset(long long int, long long int, std::vector<long long int>)':
molecules.cpp:19:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |  for(int i=0;i<w.size();i++){
      |              ~^~~~~~~~~
molecules.cpp:23:10: error: request for member 'begin' in 'w1', which is of non-class type 'std::pair<long long int, long long int> [(<anonymous> + 1)]'
   23 |  sort(w1.begin(),w1.end());
      |          ^~~~~
molecules.cpp:23:21: error: request for member 'end' in 'w1', which is of non-class type 'std::pair<long long int, long long int> [(<anonymous> + 1)]'
   23 |  sort(w1.begin(),w1.end());
      |                     ^~~
molecules.cpp:26:11: error: 'n' was not declared in this scope
   26 |  while(l1<n&&r1<n){
      |           ^