Submission #365560

#TimeUsernameProblemLanguageResultExecution timeMemory
365560iliccmarkoDetecting Molecules (IOI16_molecules)C++14
0 / 100
0 ms364 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define endl "\n"
#define INF 1000000000
#define LINF 1000000000000000LL
#define pb push_back
#define all(x) x.begin(), x.end()
#define len(s) (int)s.size()
#define test_case { int t; cin>>t; while(t--)solve(); }
#define single_case solve();
#define line cerr<<"----------"<<endl;
#define ios { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); cerr.tie(NULL); }
#define mod 1000000007LL
const int N = 2e5 + 5;
pair<int, int> a[N];

vector<int> find_subset(int l, int u, vector<int> w)
{
   vector<int> res;
   int ind = 0;
   for(int x : w)
   {
       a[ind].first = x;
       a[ind].second = ind++;
   }
   sort(a, a+ind);
   int n = ind;
   for(int i = 0;i<n;i++)
   {
       if(a[i].first>=l&&a[i].first<=u)
       {
           res.pb(a[i].second);
           return res;
       }
   }
   for(int i = 0;i<n-1;i++)
   {
       if(a[i].first+a[n-1].first>=l&&a[i].first+a[n-1].first<=u)
       {
           res.pb(a[i].second);
           res.pb(a[n-1].second);
           return res;
       }
   }
   return res;
}

Compilation message (stderr)

molecules.cpp: In function 'std::vector<int> find_subset(int, int, std::vector<int>)':
molecules.cpp:25:27: warning: operation on 'ind' may be undefined [-Wsequence-point]
   25 |        a[ind].second = ind++;
      |                        ~~~^~
molecules.cpp:25:27: warning: operation on 'ind' may be undefined [-Wsequence-point]
#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...