-
Notifications
You must be signed in to change notification settings - Fork 0
/
dima_and_guards.cpp
63 lines (53 loc) · 1.27 KB
/
dima_and_guards.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <iostream>
#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define fast_io ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define fr(i,a,b) for (int i =a;i<b;i++)
#define loop(x,n) for (int x = 0;x<n;++x)
#define mod 1000000007
#define inf (1LL<<60)
#define all(x) (x).begin(), (x).end()
using namespace std;
void precal(){
}
//vector of maps
//vector<map<int,int>>vec(3);
//vec[0] is the first map
void solve (){
int n;
cin>>n;
int a,b, c,d;
bool check = false;
for (int i =1;i<=4;i++){
cin>>a>>b>>c>>d;
// if((a<c && b<d)||(a>c && b>d)){
// continue;
// }
// cout<<"here"<<i<<endl;
int chocmin= min(a,b);
int juicemin = min(c,d);
if(n>=chocmin+juicemin){
cout<<i<<" "<<chocmin<<" "<<n-chocmin<<"\n";
// chocmin==a?cout<<chocmin<<" "<<n-chocmin:cout<<juicemin<<" "<<n-juicemin;
// cout<<"\n";
check = true;
break;
}
}
if(check==false)
cout<<-1<<'\n';
}
int main(){
fast_io;
cout<<fixed;
cout<< setprecision(10);
precal();
int t =1;
// cin>> t ;
for (int i =1;i<=t;i++){
// cout<< "Case #"<<i<<": ";
solve();
}
return 0;
}