Skip to content

Instantly share code, notes, and snippets.

@invatainfo
Created September 16, 2017 15:01
Show Gist options
  • Save invatainfo/2232f5f7606802089143e5445ad62429 to your computer and use it in GitHub Desktop.
Save invatainfo/2232f5f7606802089143e5445ad62429 to your computer and use it in GitHub Desktop.
#include <fstream>
#include <iostream>
using namespace std;
int main() {
int n, a[1000], b[1000], i, j, k;
ifstream fin("bac.txt");
fin >> n;
for (i = 1; i <= n; i++)
fin >> a[i] >> b[i];
for (i = 1; i <= n; i++) {
k = 0;
for (j = 1; j <= n; j++)
if (i != j)
if (a[i] > b[j] || a[j] > b[i])
k++;
if (k == n - 1)
cout << a[i] << " " << b[i] << endl;
}
fin.close();
system("pause");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment