제출 #603958

#제출 시각아이디문제언어결과실행 시간메모리
603958CSQ31Floppy (RMI20_floppy)C++17
100 / 100
109 ms13608 KiB
#include <stdlib.h> #include <string.h> #include <bits/stdc++.h> #include "floppy.h" using namespace std; void read_array(int subtask_id, const vector<int> &v) { string bits; stack<int>stk; int n = v.size(); for(int i=0;i<n;i++){ while(!stk.empty() && v[i] > v[stk.top()]){ bits+="1"; stk.pop(); } stk.push(i); bits+="0"; } save_to_floppy(bits); } typedef pair<int,int> pii; #define fi first #define se second vector<int> solve_queries(int subtask_id, int n,const string &bits,const vector<int> &a, const std::vector<int> &b) { int q = a.size(); vector<int>ans(q); vector<vector<pii>>qq(n); for(int i=0;i<q;i++){ qq[b[i]].push_back({a[i],i}); } vector<int>stk; int ptr = 0; for(int i=0;i<n;i++){ int cnt = 0; while(bits[ptr] == '1'){ ptr++; cnt++; } ptr++; while(cnt--)stk.pop_back(); stk.push_back(i); for(pii x:qq[i]){ int p = lower_bound(stk.begin(),stk.end(),x.fi) - stk.begin(); ans[x.se] = stk[p]; } } return ans; }

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

stub.cpp: In function 'void run2()':
stub.cpp:101:30: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
  101 |     if (query_answers.size() != M) {
      |         ~~~~~~~~~~~~~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...