Submission #1112943

# Submission time Handle Problem Language Result Execution time Memory
1112943 2024-11-15T09:46:59 Z Aviansh Curtains (NOI23_curtains) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>

using namespace std;

signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,m,q;
    cin >> n >> m >> q;
    vector<array<int,2>>events[n+1];
    for(int i = 0;i<m;i++){
        int a,b;
        cin >> a >> b;
        events[a].push_back({a,b});
    }
    bool ans[n+5][n+5];
    for(int a = 1;a<=n;a++){
        int b=n;
        int minima = a;
        priority_queue<int,vector<int>,greater<int>>mins;
        bool work = 1;
        fill(ans[i],ans[i]+n+5,0);
        for(int i = a;i<=b;i++){
            for(array<int,2>a:events[i]){
                mins.push(a[1]);
            }
            if(mins.size())
                minima=max(minima,mins.top());
            if(mins.size()==0){
                work=0;
                break;
            }
            if(minima==i&&work){
                ans[a][i]=1;
            }
            else{
                ans[a][i]=0;
            }
            while(mins.size()&&mins.top()==i){
                mins.pop();
            }
        }
    }
    while(q--){
        int a,b;
        cin >> a >> b;
        cout << (ans[a][b] ? "YES\n" : "NO\n");
    }
    return 0;
}

Compilation message

curtains.cpp: In function 'int main()':
curtains.cpp:22:18: error: 'i' was not declared in this scope
   22 |         fill(ans[i],ans[i]+n+5,0);
      |                  ^