| Task: | Poistot |
| Sender: | OorigamiK |
| Submission time: | 2025-01-18 14:35:40 +0200 |
| Language: | C++ (C++20) |
| Status: | READY |
| Result: | 0 |
| group | verdict | score |
|---|---|---|
| #1 | WRONG ANSWER | 0 |
| #2 | TIME LIMIT EXCEEDED | 0 |
| #3 | WRONG ANSWER | 0 |
| test | verdict | time | group | |
|---|---|---|---|---|
| #1 | WRONG ANSWER | 0.01 s | 1, 3 | details |
| #2 | ACCEPTED | 0.01 s | 1, 2, 3 | details |
| #3 | ACCEPTED | 0.00 s | 1, 3 | details |
| #4 | ACCEPTED | 0.01 s | 1, 3 | details |
| #5 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
| #6 | TIME LIMIT EXCEEDED | -- | 2, 3 | details |
| #7 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #8 | ACCEPTED | 0.10 s | 3 | details |
| #9 | TIME LIMIT EXCEEDED | -- | 3 | details |
| #10 | TIME LIMIT EXCEEDED | -- | 3 | details |
Compiler report
input/code.cpp: In function 'void prepJumps(std::vector<int>&, std::vector<int>&)':
input/code.cpp:6:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
6 | for (int i=0;i<list.size();i++){
| ~^~~~~~~~~~~~
input/code.cpp:9:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
9 | for (int j=i+1;j<list.size();j++){
| ~^~~~~~~~~~~~
input/code.cpp: In function 'bool round(std::vector<int>&, std::vector<int>&, std::vector<bool>&, std::vector<std::vector<int> >&)':
input/code.cpp:25:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<bool>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
25 | for (int i=0;i<gone.size();i++){
| ~^~~~~~~~~~~~
i...Code
#include <iostream>
#include <vector>
using namespace std;
void prepJumps(vector<int>& list, vector<int>& jumps){
for (int i=0;i<list.size();i++){
int n=list[i];
bool done=false;
for (int j=i+1;j<list.size();j++){
if (n<list[j]){
jumps[i]=j-i;
done=true;
break;
}
}
if (!done){
jumps[i]=-1;
}
}
}
bool round(vector<int>& list, vector<int>& jumps, vector<bool>& gone, vector<vector<int>>& removes){
int starting_index=0;
bool chosen=false;
for (int i=0;i<gone.size();i++){
if (!gone[i]){
chosen=true;
starting_index=i;
break;
}
}
if (!chosen){
return true;
}
removes.push_back({});
int size=removes.size()-1;
int index=starting_index;
//cout<<index<<"\n",
//gone[starting_index]=true;
while (jumps[index]!=-1){
while (gone[index]){
index+=jumps[index];
if (jumps[index]=-1){
if (!gone[index]){
gone[index]=true;
removes[size].push_back(list[index]);
//cout<<list[index]<<" ";
}
return false;
}
}
removes[size].push_back(list[index]);
//cout<<list[index]<<" ";
gone[index]=true;
index+=jumps[index];
}
if (!gone[index]){
removes[size].push_back(list[index]);
//cout<<list[index]<<" ";
gone[index]=true;
}
return false;
}
int main(){
int n=0;
vector<vector<int>> removes;
cin>>n;
vector<int> list(n);
vector<int> jumps(n);
vector<bool> gone(n);
for (int i=0;i<n;i++){
int k;
cin>>k;
list[i]=k;
gone[i]=false;
}
prepJumps(list, jumps);
bool done=false;
while (!done){
done=round(list, jumps, gone, removes);
}
cout<<removes.size()<<endl;
for (vector<int> removed:removes){
cout<<removed[0];
for (int k=1;k<removed.size();k++){
cout<<" "<<removed[k];
}
cout<<"\n";
}
}Test details
Test 1
Group: 1, 3
Verdict: WRONG ANSWER
| input |
|---|
| 1000 447773962 773442532 122816 137... |
| correct output |
|---|
| 53 447773962 773442532 908719430 ... |
| user output |
|---|
| 517 447773962 773442532 908719430 ... Truncated |
Test 2
Group: 1, 2, 3
Verdict: ACCEPTED
| input |
|---|
| 1000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
| correct output |
|---|
| 1000 1 1 1 1 ... |
| user output |
|---|
| 1000 1 1 1 1 ... Truncated |
Test 3
Group: 1, 3
Verdict: ACCEPTED
| input |
|---|
| 1000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| correct output |
|---|
| 1 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| 1 1 2 3 4 5 6 7 8 9 10 11 12 13 ... Truncated |
Test 4
Group: 1, 3
Verdict: ACCEPTED
| input |
|---|
| 1000 1000 999 998 997 996 995 994 9... |
| correct output |
|---|
| 1000 1000 999 998 997 ... |
| user output |
|---|
| 1000 1000 999 998 997 ... Truncated |
Test 5
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ... |
| correct output |
|---|
| 200000 1 1 1 1 ... |
| user output |
|---|
| (empty) |
Test 6
Group: 2, 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 5 2 1 10 6 10 5 5 5 4 4 2 3 7 ... |
| correct output |
|---|
| 20776 5 10 2 6 10 1 5 7 9 10 5 7 8 9 10 ... |
| user output |
|---|
| (empty) |
Test 7
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 591414747 75940263 760367935 9... |
| correct output |
|---|
| 879 591414747 760367935 901888417 ... |
| user output |
|---|
| (empty) |
Test 8
Group: 3
Verdict: ACCEPTED
| input |
|---|
| 200000 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| correct output |
|---|
| 1 1 2 3 4 5 6 7 8 9 10 11 12 13 ... |
| user output |
|---|
| 1 1 2 3 4 5 6 7 8 9 10 11 12 13 ... Truncated |
Test 9
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 200000 199999 199998 199997 19... |
| correct output |
|---|
| 200000 200000 199999 199998 199997 ... |
| user output |
|---|
| (empty) |
Test 10
Group: 3
Verdict: TIME LIMIT EXCEEDED
| input |
|---|
| 200000 199999 199997 199995 199993 19... |
| correct output |
|---|
| 100000 199999 200000 199997 199998 199995 199996 199993 199994 ... |
| user output |
|---|
| (empty) |
