Submission #1106657

#TimeUsernameProblemLanguageResultExecution timeMemory
1106657snpmrnhlolSeats (IOI18_seats)C++17
Compilation error
0 ms0 KiB
#include "seats.h"
#include <bits/stdc++.h>
using namespace std;
std::vector<std::vector<int>> v;
vector <int> x,y;
int n,m;
void give_initial_chart(int n2, int m2, std::vector<int> a, std::vector<int> b) {
    n = n2;m = m2;
    v.assign(n, vector<int>(m,0));
    x = a;
    y = b;
    for(int i = 0;i < n*m;i++){
        v[a[i]][b[i]] = i;
    }
}

int swap_seats(int a, int b){
    swap(x[a],x[b]);
    swap(y[a],y[b]);
    int ans = 0;
    for(int i = 0;i < n*m;i++){
        int r = -1,l = m,d = -1,u = n;
        l  = min(l,y[j]);
        r  = max(r,y[j]);
        u  = min(u,x[j]);
        d  = max(d,x[j]);
        if((r - l + 1)*(d - u + 1) == i + 1){
            ans++;
        }
    }
    return ans;
}
/**
2 3 1
0 0
1 0
1 1
0 1
0 2
1 2
0 5
**/

Compilation message (stderr)

seats.cpp: In function 'int swap_seats(int, int)':
seats.cpp:23:22: error: 'j' was not declared in this scope
   23 |         l  = min(l,y[j]);
      |                      ^