Submission #110683

#TimeUsernameProblemLanguageResultExecution timeMemory
110683tc_abdJakarta Skyscrapers (APIO15_skyscraper)C++14
10 / 100
3 ms384 KiB
#include <bits/stdc++.h> using namespace std; int n,m; pair < int , int > p[5]; int main(){ cin>>n>>m; for(int i=0;i<m;i++){ cin>>p[i].first>>p[i].second; } int x = abs(p[0].first-p[1].first); int mn = 1000000009; if(x%p[0].second == 0) mn = x/p[0].second; if(m == 3){ int y = abs(p[1].first-p[2].first); int xy = abs(p[0].first-p[2].first); if(y%p[2].second == 0 && xy%p[0].second == 0) mn = min(mn,xy/p[0].second+y/p[2].second); } if(mn == 1000000009) cout<<-1<<endl; else cout<<mn<<endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...