Submission #872575

#TimeUsernameProblemLanguageResultExecution timeMemory
872575ZeroDetecting Molecules (IOI16_molecules)C++17
0 / 100
1 ms348 KiB
#include <bits/stdc++.h> #include "molecules.h" #define pb push_back using namespace std; vector<int> find_subset(int l, int u, vector<int> a){ int mn = 0,n = a.size(); vector<int> v; int s = 0; for(int i=0,j=0; i < n && j < n;){ if(s>=l && s <= u){ j--; if(i == j) v.pb(i); else { for(int k=i; k <= j; k ++) v.pb(k); } break; } } for (int i = 0; i < n; ++i) { int sum = 0; for (int j = i; j < n; ++j) { sum += a[j]; int ss = 0; for (int k = i; k <= j; ++k) { sum += a[k]; } if((sum >= l && sum <= u) || (sum<=l && sum >= u)){ for(int k=i; k <= j; k ++)v.pb(k); return v; } } } return v; } // int main(){ // int l,u; cin >> l >> u; // vector<int> a(4); // for(auto &i : a) cin >> i; // vector<int> y = find_subset(l,u,a); // for(auto i : y) cout << i << " "; // return 0; // }

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:26:17: warning: unused variable 'ss' [-Wunused-variable]
   26 |             int ss = 0;
      |                 ^~
molecules.cpp:8:9: warning: unused variable 'mn' [-Wunused-variable]
    8 |     int mn = 0,n = a.size();
      |         ^~
#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...