제출 #364535

#제출 시각아이디문제언어결과실행 시간메모리
364535mathking1021Painting Walls (APIO20_paint)C++17
0 / 100
1 ms1516 KiB
#include "paint.h" #include <vector> #include <queue> #define PLL pair<ll, ll> #define F first #define S second using namespace std; typedef int ll; ll n, m, k; vector<vector<ll>> ve; vector<ll> ve2[50005], c; bool d[100005]; ll e[100005]; ll x[20005][2005]; priority_queue<PLL, vector<PLL>, greater<PLL> > pq; int minimumInstructions( int N, int M, int K, vector<int> C, vector<int> A, vector<vector<int>> B) { n = N; m = M; k = K; ve = B; c = C; for(ll i = 0; i < ve.size(); i++) { for(ll j = 0; j < ve[i].size(); j++) { ve2[ve[i][j]].push_back(i); } } for(ll i = 0; i < c.size(); i++) { for(ll j = 0; j < ve2[c[i]].size(); j++) { x[i][ve2[c[i]][j]] = 1; ll t = i - ve2[c[i]][j]; } } for(ll i = 0; i < m; i++) { ll now = 0; for(ll j = 0; j < n; j++) { if(x[j][(i + j) % m]) now++; if(j >= m && x[j - m][(i + j) % m]) now--; if(now >= m) { d[j - m] = true; } } } if(!d[0]) return -1; pq.push(make_pair(1, 0)); e[0] = 1; for(ll i = 1; i < n; i++) { while(pq.top().S < i - m) pq.pop(); ll t1 = pq.top().S; ll t2 = pq.top().F; if(d[i - 1]) e[i] = t2 + 1, pq.push(make_pair(e[i], i)); else if(i == n - m) return -1; } return e[n - m]; }

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

paint.cpp: In function 'int minimumInstructions(int, int, int, std::vector<int>, std::vector<int>, std::vector<std::vector<int> >)':
paint.cpp:29:21: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |     for(ll i = 0; i < ve.size(); i++)
      |                   ~~^~~~~~~~~~~
paint.cpp:31:25: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |         for(ll j = 0; j < ve[i].size(); j++)
      |                       ~~^~~~~~~~~~~~~~
paint.cpp:36:21: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     for(ll i = 0; i < c.size(); i++)
      |                   ~~^~~~~~~~~~
paint.cpp:38:25: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   38 |         for(ll j = 0; j < ve2[c[i]].size(); j++)
      |                       ~~^~~~~~~~~~~~~~~~~~
paint.cpp:41:16: warning: unused variable 't' [-Wunused-variable]
   41 |             ll t = i - ve2[c[i]][j];
      |                ^
paint.cpp:63:12: warning: unused variable 't1' [-Wunused-variable]
   63 |         ll t1 = pq.top().S;
      |            ^~
#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...