# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
667227 | divad | Subway (info1cup19_subway) | C++14 | 7 ms | 724 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#define int long long
using namespace std;
int k;
int gauss(int n){
return n*(n+1)/2;
}
signed main()
{
cin >> k;
int ans = 0, st = 1, dr = 45000;
/// 1 1 1 1 1 0 0 0 0 0 0
/// ^
while(st <= dr){
int mid = (st+dr)/2;
if(gauss(mid) <= k){
ans = mid;
st = mid+1;
}else{
dr = mid-1;
}
}
int rest = k-gauss(ans);
int cnt = 1+ans+(rest > 0);
cout << ans+1+(rest > 0) << "\n";
cout << "0 -1\n";
for(int i = 1; i <= ans; i++){
cout << i << " " << i-1 << "\n";
컴파일 시 표준 에러 (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... |