Advertisement
Guest User

Untitled

a guest
Oct 14th, 2017
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int n,a,b,c,d,e,f;
  6. cin>>n>>a>>b>>c>>d>>e>>f;
  7.  
  8. int k;
  9. cin>>k;
  10. vector<pair<int,pair<int,int>>> t;
  11. for(int i=0;i<k;++i) {
  12. int a,b,c;
  13. cin>>a>>b>>c;
  14. t.push_back({a,{b,c}});
  15.  
  16. }
  17.  
  18. sort(t.begin(), t.end());
  19. for(int i=0;i<k;++i) {
  20. int j=i;
  21. while(j<k && t[j].first==t[i].first) j++;
  22. j--;
  23. map<int,int> up, down;
  24. for(int kk=i;kk<=j;++kk) {
  25. up[t[j].second.second]++;
  26. down[t[j].second.first]++;
  27. }
  28.  
  29. for(auto i:up) {
  30. if(down[i.first]>0) {
  31. cerr<<"bad\n";
  32. return -1;
  33. }
  34. }
  35.  
  36. i=j;
  37. }
  38. cout<<"OK\n";
  39. return 0;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement