Submission #701886

# Submission time Handle Problem Language Result Execution time Memory
701886 2023-02-22T09:04:16 Z lto5 Lightning Rod (NOI18_lightningrod) C++14
0 / 100
1281 ms 304 KB
#include <bits/stdc++.h>
#define fi first
#define se second
#define faster ios_base::sync_with_stdio(0); cin.tie(0);
#define pb push_back
 
using namespace std;
using ll = long long;
using pii = pair <int, int>;
 
const int maxN = 1e5 + 1;
const int inf = 0x3f3f3f3f;
//const int Mod =
int n;
void Init(){
    vector <pii> S;
    cin >> n;
    for (int i = 1; i <= n; ++i){
        int x, y; cin >> x >> y;
      	///
      /// 
        while (!S.empty() && S.back().fi + S.back().se <= x + y) S.pop_back();
        if (!S.empty() && y - x <= S.back().se - S.back().fi) continue;
        S.pb({x, y}); continue;
    }
    cout << S.size();
}
 
#define taskname "test"
signed main(){
    faster
    if (fopen(taskname ".inp", "r")){
        freopen(taskname ".inp", "r", stdin);
        freopen(taskname ".out", "w", stdout);
    }
    int tt = 1;
    //cin >> tt;
    while (tt--){
        Init();
    }
    if (fopen("timeout.txt", "r")){
        ofstream timeout("timeout.txt");
        cerr << "Time elapsed: " << signed(double(clock()) / CLOCKS_PER_SEC * 1000) << "ms\n";
        timeout << signed(double(clock()) / CLOCKS_PER_SEC * 1000);
        timeout.close();
    }
}

Compilation message

lightningrod.cpp: In function 'int main()':
lightningrod.cpp:33:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |         freopen(taskname ".inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
lightningrod.cpp:34:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   34 |         freopen(taskname ".out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1253 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1281 ms 304 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1253 ms 300 KB Output isn't correct
2 Halted 0 ms 0 KB -