Submission #1004043

#TimeUsernameProblemLanguageResultExecution timeMemory
1004043irmuunSeats (IOI18_seats)C++17
11 / 100
4102 ms40900 KiB
#include<bits/stdc++.h> #include "seats.h" using namespace std; #define ll long long #define pb push_back #define ff first #define ss second #define all(s) s.begin(),s.end() #define rall(s) s.rbegin(),s.rend() int n,h,w; vector<int>r,c; void give_initial_chart(int H,int W,vector<int>R,vector<int>C){//len HW h=H,w=W,r=R,c=C,n=H*W; } int swap_seats(int a,int b){ swap(r[a],r[b]); swap(c[a],c[b]); int ans=0,r1=h,r2=0,c1=w,c2=0; for(int i=0;i<n;i++){ r1=min(r1,r[i]); r2=max(r2,r[i]); c1=min(c1,c[i]); c2=max(c2,c[i]); if((r2-r1+1)*(c2-c1+1)==i+1){ ans++; } } return ans; }
#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...