Skip to content

Instantly share code, notes, and snippets.

@m4scosta
Created May 5, 2015 11:59
Show Gist options
  • Save m4scosta/d0495199f0f0f9dc48e9 to your computer and use it in GitHub Desktop.
Save m4scosta/d0495199f0f0f9dc48e9 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstdlib>
using namespace std;
int main()
{
int n, qt, s, ganhador, x;
vector<pair<int, int> > dist;
cin >> n;
while (n--) {
cin >> qt >> s;
dist.clear();
for (int i = 0; i < 0; i++) {
cin >> x;
dist.push_back(make_pair(abs(x - s), i));
}
sort(dist.begin(), dist.end());
cout << dist[0].second << endl;
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment