제출 #987703

#제출 시각아이디문제언어결과실행 시간메모리
987703wood자리 배치 (IOI18_seats)C++17
0 / 100
4030 ms39764 KiB
#include "seats.h"
#include <bits/stdc++.h>  
using namespace std;
 
typedef long long ll;
typedef pair<int,int> p32;
typedef pair<ll,ll> p64;
#define pb push_back
#define eb emplace_back
#define fi first
#define se second
#define vi vector<int>
#define vp32 vector<p32>
#define fast_cin() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL)
#define MOD %1000000007
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template <class T>
using Tree =
    tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
//never guess
//never debug without reviewing code
//never try adding ones or substracting them
//only step by step debug when necessay


namespace potato{
    int H,W; vi R,C;
}

void give_initial_chart(int H, int W, std::vector<int> R, std::vector<int> C) {
    potato::H = H, potato::W = W, potato::R = R, potato::C = C;
}

int swap_seats(int a, int b) {
    using namespace potato;
    int rmin = R[0], rmax  = R[0], cmin = C[0], cmax = C[0];
    int res = 1;
    for (size_t i = 1; i < H*W; i++)
    {
        rmin = min(rmin,R[i]); rmax = max(rmax,R[i]);
        cmin = min(cmin,C[i]); cmax = max(cmax,C[i]);
        if(i+1==(rmax-rmin)*(cmax-cmin)) res++;
    }
    return res;
}

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

seats.cpp: In function 'int swap_seats(int, int)':
seats.cpp:39:26: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   39 |     for (size_t i = 1; i < H*W; i++)
      |                        ~~^~~~~
seats.cpp:43:15: warning: comparison of integer expressions of different signedness: 'std::size_t' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   43 |         if(i+1==(rmax-rmin)*(cmax-cmin)) res++;
      |            ~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#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...