QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#855296#149. PeruKatharsisCompile Error//C++23389b2025-01-12 17:22:132025-01-12 17:22:13

Judging History

你现在查看的是最新测评结果

  • [2025-01-12 17:22:13]
  • 评测
  • [2025-01-12 17:22:13]
  • 提交

answer

#include<bits/stdc++.h>
#include"peru.h"
constexpr long long m  = 1e9 + 7;
int solve(int n, int k, int* s){
	deque<int> dq;
	long long res = 0;
	for(int i = 0; i < n; ++i){
		while(!dq.empty() && s[dq.back()] < s[i]) dq.pop_back();
		dq.push_back(i);
		if(i >= k) {
			if(dq.front() == i - k)
				dq.pop_front();
		}
		res = ((res * 23) + dq.front()) % m;
	}
	return res;
}

Details

implementer.cpp: In function ‘char nextch()’:
implementer.cpp:15:31: warning: ignoring return value of ‘size_t fread(void*, size_t, size_t, FILE*)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |     if (pos == BUF_SIZE) fread(buf, BUF_SIZE, 1, fin), pos = 0;
      |                          ~~~~~^~~~~~~~~~~~~~~~~~~~~~~
answer.code: In function ‘int solve(int, int, int*)’:
answer.code:5:9: error: ‘deque’ was not declared in this scope
    5 |         deque<int> dq;
      |         ^~~~~
answer.code:5:9: note: suggested alternatives:
In file included from /usr/include/c++/13/deque:66,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:139,
                 from answer.code:1:
/usr/include/c++/13/bits/stl_deque.h:788:11: note:   ‘std::deque’
  788 |     class deque : protected _Deque_base<_Tp, _Alloc>
      |           ^~~~~
/usr/include/c++/13/deque:83:13: note:   ‘std::pmr::deque’
   83 |       using deque = std::deque<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~
answer.code:5:15: error: expected primary-expression before ‘int’
    5 |         deque<int> dq;
      |               ^~~
answer.code:8:24: error: ‘dq’ was not declared in this scope
    8 |                 while(!dq.empty() && s[dq.back()] < s[i]) dq.pop_back();
      |                        ^~
answer.code:9:17: error: ‘dq’ was not declared in this scope
    9 |                 dq.push_back(i);
      |                 ^~