135102025-01-08 09:06:16feheristvanTalálkozáscpp17Forditási hiba
#include <iostream>
#include <vector>

using namespace std;

int main()
{
    int n;
    int megy[100000] = {0};
    int jon[100000] = {0};
    int x, y, maxx = 0;
    cin >> n;
    for(int i = 0; i < n ; i ++){
        cin >> x >> y;
        jon[x] ++;
        megy[y] ++;
    }
    maxx = y;
    int lx = 0, ly = INT_MAX, j = 0, ossz;
    bool t = 1;
    for(int i = 1 ; i <= maxx; i ++){
        while(j < maxx and ossz < (n + 1) / 2){
            j ++;
            ossz += jon[j];
        }
        if(j == maxx and ossz < (n + 1) / 2){
            t = 0;
        }
        if(j - i + 1 < ly - lx + 1 and ossz >= (n + 1) / 2 and t){
            ly = j;
            lx = i;
        }
        ossz -= megy[i];
    }
    cout << ly - lx + 1 << endl;
    cout <<lx << " " << ly;
    return 0;
}
Forditási hiba
open /var/local/lib/isolate/409/box/a.out: no such file or directory
main.cpp: In function 'int main()':
main.cpp:19:22: error: 'INT_MAX' was not declared in this scope
   19 |     int lx = 0, ly = INT_MAX, j = 0, ossz;
      |                      ^~~~~~~
main.cpp:3:1: note: 'INT_MAX' is defined in header '<climits>'; did you forget to '#include <climits>'?
    2 | #include <vector>
  +++ |+#include <climits>
    3 | 
main.cpp:22:15: error: 'j' was not declared in this scope
   22 |         while(j < maxx and ossz < (n + 1) / 2){
      |               ^
main.cpp:22:28: error: 'ossz' was not declared in this scope
   22 |         while(j < maxx and ossz < (n + 1) / 2){
      |                            ^~~~
main.cpp:26:12: error: 'j' was not declared in this scope
   26 |         if(j == maxx and ossz < (n + 1) / 2){
      |            ^
main.cpp:26:26: error: 'ossz' was not declared in this scope
   26 |         if(j == maxx and ossz < (n + 1) / 2){
      |                          ^~~~
main.cpp:29:12: error: 'j' was not declared in this scope
   29 |         if(j - i + 1 < ly - lx + 1 and ossz >= (n + 1) / 2 and t){
      |            ^
main.cpp:29:40: error: 'ossz' was not declared in this scope
   29 |         if(j - i + 1 < ly - lx + 1 and ossz >= (n + 1) / 2 and t){
      |                                        ^~~~
main.cpp:33:9: error: 'ossz' was not declared in this scope
   33 |         ossz -= megy[i];
      |         ^~~~