(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #1106659

#TimeUsernameProblemLanguageResultExecution timeMemory
1106659snpmrnhlolSeats (IOI18_seats)C++17
11 / 100
4062 ms44804 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; int r = -1,l = m,d = -1,u = n; for(int i = 0;i < n*m;i++){ l = min(l,y[i]); r = max(r,y[i]); u = min(u,x[i]); d = max(d,x[i]); 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 **/
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...