이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "paint.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double db;
typedef pair<ll,ll> pl;
typedef vector<ll> vl;
#define pb push_back
#define po pop_back
#define ff first
#define ss second
#define MIN -1e18
#define MAX 1e18
#define lw lower_bound
// typedef tree<ll , null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update> indexed_set;
// template< typename T>
// using indexed_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
ll n,m,mid,mn,T,sum,c[1234567],h1,h2,x,y,z,l,r,cnt,cnt1,ans;
vector<ll> vec[1234567];
bool ok[1234567],ok1;
int minimumInstructions(
int N, int M, int K, std::vector<int> C,
std::vector<int> A, std::vector<std::vector<int>> B) {
for(int i=0;i<M;i++){
for(auto u:B[i]) vec[u].pb(i);
}
vector<vector<ll> > mp(M);
for(int i=0;i<N;i++){
for(auto u:vec[C[i]]){
mp[((u-i)%M+M)%M].pb(i);
}
}
vl v(N);
for(auto u:mp){
ll last = N+1;
ll len =0;
for(int i=u.size()-1;i>=0;i--){
if(u[i]+1!=last)last=0;
last++;
v[u[i]]=max(v[u[i]],len);
last=u[i];
}
}
vl ok;
for(int i=0;i<N;i++)if(v[i]>=M)ok.pb(i);
ll Rpoint=0;
ll id=0;
while(Rpoint<N){
while(id<ok.size()&&ok[id]<=Rpoint){
id++;
}
if(id==0)return -1;
ll Lpoint = ok[id-1];
if(Lpoint + M <= Rpoint)return -1;
ans++;
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
paint.cpp: In function 'int minimumInstructions(int, int, int, std::vector<int>, std::vector<int>, std::vector<std::vector<int> >)':
paint.cpp:49:11: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
49 | while(id<ok.size()&&ok[id]<=Rpoint){
| ~~^~~~~~~~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |