제출 #670915

#제출 시각아이디문제언어결과실행 시간메모리
670915Dan4LifeJakarta Skyscrapers (APIO15_skyscraper)C++17
10 / 100
1 ms340 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll = long long;
const int maxn = (int)2e3+10;
const ll LINF = (ll)1e18;
int n, m, ans, a[maxn], b[maxn];

int mv(int x, int y){
	int dis = abs(a[x]-a[y]);
	if(dis%b[x]) return LINF;
	return dis/b[x];
}

int32_t main() {
	cin >> n >> m; ans = LINF;
	for(int i = 0; i < m; i++) cin >> a[i] >> b[i];
	if(m<=3){
		ans = min(ans, mv(0,1));
		if(m==3) ans = min(ans, mv(0,2)+mv(2,1));
		if(ans==LINF) ans=-1; cout << ans;
	}
}

컴파일 시 표준 에러 (stderr) 메시지

skyscraper.cpp: In function 'int32_t main()':
skyscraper.cpp:21:3: warning: this 'if' clause does not guard... [-Wmisleading-indentation]
   21 |   if(ans==LINF) ans=-1; cout << ans;
      |   ^~
skyscraper.cpp:21:25: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'if'
   21 |   if(ans==LINF) ans=-1; cout << ans;
      |                         ^~~~
#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...