QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#831140 | #8903. Тайное послание | Wanye | Compile Error | / | / | C++14 | 1000b | 2024-12-25 11:10:01 | 2024-12-25 11:10:30 |
Judging History
answer
std::vector<int> Encode(int n, int k, std::vector<int> T){
vector<int> vis(n);
stack<int> sta;
while(sta.size()) sta.pop();
for(int i=0;i<n;i++) vis[i]=0;
for(int i=0;i<k;i++) vis[T[i]-1]=1;
for(int i=0;i<n;i++){
if(vis[i]==1) sta.push(i);
else if(sta.size()){
sta.pop();
vis[i]=2;
}
}
for(int i=0;i<n;i++){
if(sta.size()&&!vis[i]){
vis[i]=2;
sta.pop();
}
}
vector<int> R(0);
for(int i=0;i<n;i++) if(vis[i]==2) R.push_back(i+1);
return R;
}
std::vector<int> Decode(int n, int k, std::vector<int> R){
vector<int> vis(n);
stack<int> sta;
while(sta.size()) sta.pop();
for(int i=0;i<n;i++) vis[i]=0;
for(int i=0;i<k;i++) vis[R[i]-1]=1;
for(int i=n-1;i>=0;i--){
if(vis[i]==1) sta.push(i);
else if(sta.size()){
sta.pop();
vis[i]=2;
}
}
for(int i=n-1;i>=0;i--){
if(sta.size()&&!vis[i]){
vis[i]=2;
sta.pop();
}
}
vector<int> T(0);
for(int i=0;i<n;i++) if(vis[i]==2) T.push_back(i+1);
return T;
}
详细
answer.code:1:6: error: ‘vector’ in namespace ‘std’ does not name a template type 1 | std::vector<int> Encode(int n, int k, std::vector<int> T){ | ^~~~~~ answer.code:1:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’? +++ |+#include <vector> 1 | std::vector<int> Encode(int n, int k, std::vector<int> T){ answer.code:24:6: error: ‘vector’ in namespace ‘std’ does not name a template type 24 | std::vector<int> Decode(int n, int k, std::vector<int> R){ | ^~~~~~ answer.code:24:1: note: ‘std::vector’ is defined in header ‘<vector>’; did you forget to ‘#include <vector>’? 24 | std::vector<int> Decode(int n, int k, std::vector<int> R){ | ^~~