Submission #370447

#TimeUsernameProblemLanguageResultExecution timeMemory
370447amano_hinaDetecting Molecules (IOI16_molecules)C++14
Compilation error
0 ms0 KiB
#include "molecules.h" #include<bits/stdc++.h> using namespace std; typedef int long long; std::vector<int> find_subset(int l, int u, std::vector<int> w) { int n=w.size(); sort(w.begin(),w.end()); vector<int> ans; int mn=0,mx=0,cnt; bool d=1; for(int i=0;i<n;i++) { mn=mn+w[i]; mx=mx+w[n-1-i]; if(mn>=l&&mn<=u) { for(int j=0;j<=i;j++) { ans.push_back(j); } break; } else if(mx>=l&&mx<=u) { for(int j=n-1;j>=n-1-i;j--) { ans.push_back(j); } break; } else if(mn<l&&u<mx) { cnt=mn; for(int j=i;j>=0;j--) { cnt=cnt-w[j]+w[n-1-(i-j)]; if(cnt>=l&&cnt<=u) { for(int k=0;k<j;k++) { ans.push_back(k); } for(int k=n-1;k>=n-1-(i-j);k--) { ans.push_back(k); } break; } } break; } } return ans; }

Compilation message (stderr)

molecules.cpp:4:18: error: declaration does not declare anything [-fpermissive]
    4 | typedef int long long;
      |                  ^~~~
molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:10:10: warning: unused variable 'd' [-Wunused-variable]
   10 |     bool d=1;
      |          ^