| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 786123 | christinelynn | Jakarta Skyscrapers (APIO15_skyscraper) | C++17 | 1 ms | 276 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define fi first
#define sec second
#define pb push_back
#define pqueue priority_queue
#define int long long
#define pii pair<int,int>
#define supercepat ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(0);
using namespace std;
int tc,ans=0,n,m;
int b[30005],p[30005];
main(){
supercepat;
cin>>n>>m;
for(int i=0;i<m;i++){
cin>>b[i]>>p[i];
}
if(m==2){
if(abs(b[1]-b[0])%p[0]==0) cout<<abs(b[1]-b[0])/p[0];
else cout<<-1<<endl;
}
else if(m==3){
ans=LLONG_MAX;
//langsung
bool ok=0;
if(abs(b[1]-b[0])%p[0]==0){
ok=1;
ans=min(ans,abs(b[1]-b[0])/p[0]);
}
//ke 2 dulu
if(abs(b[2]-b[0])%p[0]==0&&abs(b[2]-b[1])%p[2]==0){
ok=1;
ans=min(ans,(abs(b[2]-b[0])/p[0])+(abs(b[2]-b[1])/p[2]));
}
if(ok) cout<<ans<<endl;
else cout<<-1<<endl;
}
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
