제출 #1111554

#제출 시각아이디문제언어결과실행 시간메모리
1111554SalihSahinSeats (IOI18_seats)C++14
11 / 100
4066 ms40760 KiB
#include <bits/stdc++.h>
#define pb push_back
#include "seats.h"
using namespace std;

vector<pair<int, int> > pos;

void give_initial_chart(int H, int W, vector<int> R, vector<int> C){
  pos.resize(H * W);

  for(int i = 0; i < H; i++){
    for(int j = 0; j < W; j++){
      pos[i*W + j] = {R[i * W + j], C[i * W + j]};
    }
  }
}

int swap_seats(int a, int b) {
  swap(pos[a], pos[b]);

  int mnx = pos.size(), mxx = 0, mny = pos.size(), mxy = 0;
  int ans = 0;
  for(int i = 0; i < pos.size(); i++){
    mnx = min(mnx, pos[i].second);
    mxx = max(mxx, pos[i].second);
    mny = min(mny, pos[i].first);
    mxy = max(mxy, pos[i].first);

    if((mxx - mnx + 1) * (mxy - mny + 1) == (i + 1)){
      ans++;
    }
  }

  return ans;
}

컴파일 시 표준 에러 (stderr) 메시지

seats.cpp: In function 'int swap_seats(int, int)':
seats.cpp:23:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |   for(int i = 0; i < pos.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...