Submission #138279

#TimeUsernameProblemLanguageResultExecution timeMemory
138279wzySeats (IOI18_seats)C++11
11 / 100
1993 ms33016 KiB
#include "seats.h" #include <bits/stdc++.h> using namespace std; const int N = 10005; std::vector<int> r; int posX[N] ,posY[N]; int H , W; void give_initial_chart(int Hw, int Ww, std::vector<int> R, std::vector<int> C) { H = Hw, W = Ww; for(int i = 0 ; i < R.size() ; i ++){ posX[i] = R[i]; posY[i] = C[i]; } } int swap_seats(int a, int b) { swap(posX[a] , posX[b]); swap(posY[a] , posY[b]); int minvlX = 1000000000 , maxvlX = -1; int minvlY = 1000000000 , maxvlY = -1; int cnt = 0; for(int i = 0 ; i < H*W ; i++){ minvlX = min(minvlX , posX[i]) , maxvlX = max(maxvlX , posX[i]); minvlY = min(minvlY , posY[i]) , maxvlY = max(maxvlY , posY[i]); if((abs(minvlX - maxvlX ) + 1 ) * (abs(minvlY - maxvlY) + 1) == i + 1){ cnt++; } } return cnt; }

Compilation message (stderr)

seats.cpp: In function 'void give_initial_chart(int, int, std::vector<int>, std::vector<int>)':
seats.cpp:10:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i = 0 ; i < R.size() ; i ++){
                   ~~^~~~~~~~~~
#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...