Submission #603114

# Submission time Handle Problem Language Result Execution time Memory
603114 2022-07-23T15:40:56 Z peuch Event Hopping (BOI22_events) C++17
Compilation error
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;

int n, q;

struct interval{
    int l, r, id;
    void scan(int _id){
        scanf("%d %d", &l, &r);
        id = _id;
    }
    bool operator < (interval x){
        if(r == x.r) return l < x.l;
        return r < x.r;
    }
}v[MAXN];

struct query{
    int ini, fim;
    void scan(int _id){
        scanf("%d %d", &l, &r);
        id = _id;
    }
    bool operator < (interval x){
        if(r == x.r) return l < x.l;
        return r < x.r;
    }
}v[MAXN];

int main(){
    scanf("%d %d", &n, &q);
    for(int i = 1; i <= n; i++)
        v[i].scan(i);
    for(int i = 1; i <= q; i++)
    
    sort(v + 1, v + 1 + n);
    for(int i = 1; i <= )
}

Compilation message

events.cpp:16:4: error: 'MAXN' was not declared in this scope
   16 | }v[MAXN];
      |    ^~~~
events.cpp: In member function 'void query::scan(int)':
events.cpp:21:25: error: 'l' was not declared in this scope
   21 |         scanf("%d %d", &l, &r);
      |                         ^
events.cpp:21:29: error: 'r' was not declared in this scope
   21 |         scanf("%d %d", &l, &r);
      |                             ^
events.cpp:22:9: error: 'id' was not declared in this scope; did you mean '_id'?
   22 |         id = _id;
      |         ^~
      |         _id
events.cpp: In member function 'bool query::operator<(interval)':
events.cpp:25:12: error: 'r' was not declared in this scope
   25 |         if(r == x.r) return l < x.l;
      |            ^
events.cpp:25:29: error: 'l' was not declared in this scope
   25 |         if(r == x.r) return l < x.l;
      |                             ^
events.cpp:26:16: error: 'r' was not declared in this scope
   26 |         return r < x.r;
      |                ^
events.cpp: At global scope:
events.cpp:28:4: error: 'MAXN' was not declared in this scope
   28 | }v[MAXN];
      |    ^~~~
events.cpp: In function 'int main()':
events.cpp:33:9: error: 'v' was not declared in this scope
   33 |         v[i].scan(i);
      |         ^
events.cpp:36:10: error: 'v' was not declared in this scope
   36 |     sort(v + 1, v + 1 + n);
      |          ^
events.cpp:37:25: error: expected primary-expression before ')' token
   37 |     for(int i = 1; i <= )
      |                         ^
events.cpp:37:24: error: expected ';' before ')' token
   37 |     for(int i = 1; i <= )
      |                        ^~
      |                        ;
events.cpp:38:1: error: expected primary-expression before '}' token
   38 | }
      | ^
events.cpp:31:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   31 |     scanf("%d %d", &n, &q);
      |     ~~~~~^~~~~~~~~~~~~~~~~