Submission #95731

# Submission time Handle Problem Language Result Execution time Memory
95731 2019-02-02T08:32:46 Z tqbfjotld Mechanical Doll (IOI18_doll) C++14
0 / 100
62 ms 5180 KB
#include "doll.h"
#include <vector>
#include <utility>
using namespace std;
pair<int,int> ans2[100005];
int ans[100005];
using namespace std;
void create_circuit(int M, std::vector<int> A) {
    vector<int> X;
    vector<int> Y;
    for (int x = 0; x<M+1; x++){
        ans2[x].first = -x;
        ans2[x].second = -x;
    }
    for (int x = 0; x<A.size()-1; x++){
        if (ans2[A[x]].second == A[x]){
            ans2[A[x]].second = A[x+1];
        }
        else{
            ans2[A[x]].first = ans2[A[x]].second;
            ans2[A[x]].second = A[x+1];

        }
    }
    if (ans2[A[A.size()-1]].second == -A[A.size()-1]){
        ans2[A[A.size()-1]].second = 0;
    }
    else{
        ans2[A[A.size()-1]].first = ans2[A[A.size()-1]].second;
        ans2[A[A.size()-1]].second = 0;

    }
    vector<int> C;
    for (int x = 0; x<M+1; x++){
        C.push_back(-x);
        if (x==0) continue;
        X.push_back(ans2[x].first);
        Y.push_back(ans2[x].second);
    }

    C[0] = A[0];

    answer(C, X, Y);
}

Compilation message

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:15:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   15 |     for (int x = 0; x<A.size()-1; x++){
      |                     ~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 62 ms 5180 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 62 ms 5180 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Incorrect 62 ms 5180 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB wrong motion
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB wrong motion
2 Halted 0 ms 0 KB -