Submission #499567

#TimeUsernameProblemLanguageResultExecution timeMemory
499567RandeLjeto (COCI21_ljeto)C++14
25 / 50
1 ms204 KiB
#include<iostream> #include<vector> #include<algorithm> bool cmp(std::pair<int,int> A , std::pair<int,int> B){ return A.second<B.second; } int main(){ int n; std::cin>>n; std::vector<std::pair<int,int>> v; std::vector<std::pair<int,int>>::iterator it; for(int i=0 ; i<n ;i++){ int x,y,z; std::cin>>x>>y>>z; v.push_back(std::make_pair(x,y)); } std::sort(v.begin(),v.end(),cmp); int x = v.begin()->second; int y = v.begin()->first; int ans1 = 0; int ans2 = 0; if(x<5){ ans1 = 100; } else{ ans2 = 100; } for( it = v.begin()+1 ; it!=v.end() ; it++){ int a = it->second; int b = it->first; if(a==x && abs(y-b)<=10 && a<5){ ans1 = ans1 + 150; } else if(a==x && abs(y-b)<=10 && a>4){ ans2 = ans2 + 150; } else if(a>4){ ans2 = ans2 + 100; } else if(a<5){ ans1 = ans1 + 100; } x = a; y = b; } std::cout << ans1 << " " << ans2 << std::endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...