Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main() {
- int n,a,b,c,d,e,f;
- cin>>n>>a>>b>>c>>d>>e>>f;
- int k;
- cin>>k;
- vector<pair<int,pair<int,int>>> t;
- for(int i=0;i<k;++i) {
- int a,b,c;
- cin>>a>>b>>c;
- t.push_back({a,{b,c}});
- }
- sort(t.begin(), t.end());
- for(int i=0;i<k;++i) {
- int j=i;
- while(j<k && t[j].first==t[i].first) j++;
- j--;
- map<int,int> up, down;
- for(int kk=i;kk<=j;++kk) {
- up[t[j].second.second]++;
- down[t[j].second.first]++;
- }
- for(auto i:up) {
- if(down[i.first]>0) {
- cerr<<"bad\n";
- return -1;
- }
- }
- i=j;
- }
- cout<<"OK\n";
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement