Submission #675776

# Submission time Handle Problem Language Result Execution time Memory
675776 2022-12-27T21:14:17 Z Victor Osumnjičeni (COCI21_osumnjiceni) C++17
0 / 110
1000 ms 12888 KB
// #pragma GCC target ("avx,avx2,fma")
// #pragma GCC optimize ("Ofast,inline") // O1 - O2 - O3 - Os - Ofast
// #pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

#define rep(i, a, b) for (int i = (a); i < (b); ++i)
#define per(i, a, b) for (int i = (b) - 1; i >= (a); --i)
#define trav(a, x) for (auto &a : x)

#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define pb push_back
#define debug(x) cout<<#x<<" = "<<x<<endl

#define umap unordered_map
#define uset unordered_set

typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<vi> vvi;

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef vector<pll> vpll;

const int INF = 1'000'000'007;

int main() {
    cin.tie(0)->sync_with_stdio(0);
    cin.exceptions(cin.failbit);

    int n,q;
    int heights[200005][2];
    cin>>n;
    rep(i,0,n) rep(j,0,2) cin>>heights[i][j];
    cin>>q;
    while(q--) {
        int lo,hi;
        cin>>lo>>hi;
        --lo;
        vii sweep;
        rep(i,lo,hi) rep(j,0,2) sweep.emplace_back(heights[i][j],j);
        sort(all(sweep));
        int cnt=0,ans=0;
        trav(item,sweep) {
            if(item.second) --cnt;
            else ++cnt;
            ans=max(ans,cnt);
        }
        cout<<ans<<endl;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 70 ms 9772 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 960 ms 2424 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 960 ms 2424 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1057 ms 12888 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 70 ms 9772 KB Output isn't correct
2 Halted 0 ms 0 KB -