# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
209544 | Alexa2001 | Lightning Rod (NOI18_lightningrod) | C++17 | 794 ms | 224076 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
const int Nmax = 1e7 + 5;
int x[Nmax], y[Nmax], n;
bitset<Nmax> good;
const int bsize = 1<<18;
char buffer[bsize+2];
int cursor;
static inline void init_read()
{
fread(buffer, 1, bsize, stdin), cursor = 0;
}
void read(int &x)
{
x = 0;
while(!isdigit(buffer[cursor]))
{
++cursor;
if(cursor == bsize) init_read();
}
while(isdigit(buffer[cursor]))
{
x = x * 10 + buffer[cursor] - '0';
++cursor;
if(cursor == bsize) init_read();
}
}
int main()
{
// freopen("input", "r", stdin);
init_read();
int i;
int ans = 0;
read(n);
for(i=1; i<=n; ++i) read(x[i]), read(y[i]);
int mx = INT_MIN;
for(i=1; i<=n; ++i)
if(x[i] + y[i] > mx) good[i] = 1, mx = x[i] + y[i];
mx = INT_MIN;
for(i=n; i; --i)
if(y[i] - x[i] > mx) mx = y[i] - x[i], ans += good[i];
cout << ans << '\n';
return 0;
}
컴파일 시 표준 에러 (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... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |