제출 #417859

#제출 시각아이디문제언어결과실행 시간메모리
417859ioi자리 배치 (IOI18_seats)C++14
5 / 100
4094 ms43676 KiB
#include "seats.h" #include<bits/stdc++.h> using namespace std ; vector<vector<int> > matrix ; vector<int> r , c ; int h , w ; void give_initial_chart(int H, int W, vector<int> R, vector<int> C) { r = R , c = C ; h = H , w = W ; matrix.resize(H); for(int i = 0 ;i < H ; i ++)matrix[i].resize(W); for(int i = 0 ; i < H * W ; i ++) matrix[R[i]][C[i]] = i ; } int swap_seats(int a, int b) { swap(matrix[r[a]][c[a]] , matrix[r[b]][c[b]]); swap(r[a] , r[b]); swap(c[a] , c[b]); int ans = 0 ; for(int i = 0 ; i < h ; i ++ ){ for(int j = 0 ; j < w ; j ++ ){ for(int er = i ; er < h ; er ++){ for(int ec = j ; ec < w ; ec ++){ long long sum = 0 ; for(int ii = i ; ii <= er ; ii ++) for(int jj = j ; jj <= ec ; jj ++) sum += matrix[ii][jj]; long long sz = (ec - j + 1) * (er - i + 1); if(sum == sz * (sz - 1) / 2)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...