陶索梓 @ 2018-08-18 19:49:57
编译失败 Error decompressing the archive file : Traceback (most recent call last): File "/var/task/app.py", line 75, in judge_handler tar.extractall(extract_dir) File "/usr/lib64/python2.7/tarfile.py", line 2079, in extractall self.extract(tarinfo, path) File "/usr/lib64/python2.7/tarfile.py", line 2116, in extract self._extract_member(tarinfo, os.path.join(path, tarinfo.name)) File "/usr/lib64/python2.7/tarfile.py", line 2192, in _extract_member self.makefile(tarinfo, targetpath) File "/usr/lib64/python2.7/tarfile.py", line 2233, in makefile copyfileobj(source, target) File "/usr/lib64/python2.7/tarfile.py", line 266, in copyfileobj shutil.copyfileobj(src, dst) File "/usr/lib64/python2.7/shutil.py", line 52, in copyfileobj fdst.write(buf) IOError: [Errno 28] No space left on device######## ####
#include <iostream>
#include <cstring>
using namespace std;
int n, k;
int a[100002];
struct queue1 {//单调增队列
int head1, tail1;
int q[100002];
queue1() {
head1 = 1,tail1 = 0;
memset(q, 0, sizeof(q));
}
void pop() {
head1++;
}
void push(int x) {
while(x < q[tail1] && head1 <= tail1) {
tail1--;
if(tail1 < head1){
}
}
tail1++;
q[tail1] = x;
}
int front(){
return q[head1];
}
};
struct queue2 {//单调减队列
int head2 , tail2 ;
int q[100002];
queue2() {
head2 = 1,tail2 = 0;
memset(q, 0, sizeof(q));
}
void push(int x) {
while(x > q[tail2] && head2 <= tail2) {
tail2--;
}
tail2++;
q[tail2] = x;
}
void pop() {
head2++;
}
int front(){
return q[head2];
}
};
int main() {
cin >> n >> k;
for(int i = 1; i <= n; i++) {
cin >> a[i];
}
queue1 q1;
for(int i = 1; i <= k; i++) {
q1.push(a[i]);
}
cout <<q1.front() <<" ";
for(int i = k + 1; i <= n; i++) {
q1.push(a[i]);
if(q1.tail1 - q1.head1 > 2 || (a[i] != q1.front() && a[i - 1] != q1.front() && a[i - 2] != q1.front()))q1.pop();
cout << q1.front() << " ";
}
cout << endl;
queue2 q2;
for(int i = 1; i <= k; i++) {
q2.push(a[i]);
}
cout <<q2.front() <<" ";
for(int i = k + 1; i <= n; i++) {
q2.push(a[i]);
if(q2.tail2 - q2.head2 > 2 || (a[i] != q2.front() && a[i - 1] != q2.front() && a[i - 2] != q2.front()))q2.pop();
cout << q2.front() << " ";
}
cout << endl;
return 0;
}
by Itst @ 2018-08-18 19:51:57
@陶索梓 选错语言了???
by 小可爱三岁七 @ 2018-08-18 19:52:30
@陶索梓 能过啊
是不是你版本问题?
by 陶索梓 @ 2018-08-18 19:55:36
@小可爱三岁七 感谢评论 确实选错语言了
by 陶索梓 @ 2018-08-18 19:55:51
@Itst 感谢评论 确实选错语言了
by memset0 @ 2018-08-18 20:01:52
@陶索梓 我觉得您好像没有选错语言。。。
by memset0 @ 2018-08-18 20:02:08
@陶索梓 https://www.luogu.org/discuss/show/57889 了解一下。。。
by 陶索梓 @ 2018-08-18 20:48:56
@memset0 我之前选的c++, 改成c++11后过了
by memset0 @ 2018-08-18 20:55:34
@陶索梓 您再交一遍c++也能过