Submission #139255

# Submission time Handle Problem Language Result Execution time Memory
139255 2019-07-31T13:32:54 Z PedroBigMan Mechanical Doll (IOI18_doll) C++14
0 / 100
2 ms 204 KB
#include "doll.h"
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <string>
using namespace std;
typedef int ll;
typedef unsigned long long int ull;
typedef long double ld;
#define REP(i,a,b) for(ll i=a; i<b; i++)
#define pb push_back
#define mp make_pair
#define pl pair<ll,ll>
#define ff first
#define ss second
#define INF ((ll) pow(2,63) -1)
ll insig;
#define In(vecBRO, LENBRO) REP(IBRO,0,LENBRO) {cin>>insig; vecBRO.pb(insig);}
void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}

void create_circuit(int M, std::vector<int> A) 
{
    vector<ll> fol; vector<pl> sw; vector<bool> visited;
    REP(i,0,M+1) {fol.pb(0);visited.pb(false);}
    fol[0]=0; visited[0]=A[0];
    ll cur=0;ll N=A.size(); ll last=-1;
    REP(i,0,N)
    {
        cur = A[i];
        if(!visited[cur]) 
        {
            fol[cur]=0;
            if(i>=1) 
            {
                if(last>=0) {fol[last]=cur;}
                else {sw[sw.size()-1].ss=cur;}
            }
            last=cur;
        }
        else if(last==cur)
        {
            sw.pb(mp(cur,0));
            fol[cur]=-sw.size();
            last=-sw.size();
        }
        else
        {
            if(last>=0) {fol[last]=cur;}
            else {sw[sw.size()-1].ss=cur;}
            sw.pb(mp(fol[cur],0));
            fol[cur]=-sw.size();
            last=-sw.size();
        }
        visited[cur]=true;
    }
    vector<ll> X,Y;
    REP(i,0,sw.size()) {X.pb(sw[i].ff); Y.pb(sw[i].ss);}
    answer(fol, X, Y);
}

Compilation message

doll.cpp: In function 'void Out(std::vector<int>)':
doll.cpp:11:33: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 | #define REP(i,a,b) for(ll i=a; i<b; i++)
......
   20 | void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}
      |                             ~~~~~~~~~~~~
doll.cpp:20:25: note: in expansion of macro 'REP'
   20 | void Out(vector<ll> x) {REP(i,0,x.size()) {cout<<x[i]<<" ";} cout<<endl;}
      |                         ^~~
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:11:33: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 | #define REP(i,a,b) for(ll i=a; i<b; i++)
......
   58 |     REP(i,0,sw.size()) {X.pb(sw[i].ff); Y.pb(sw[i].ss);}
      |         ~~~~~~~~~~~~~            
doll.cpp:58:5: note: in expansion of macro 'REP'
   58 |     REP(i,0,sw.size()) {X.pb(sw[i].ff); Y.pb(sw[i].ss);}
      |     ^~~
# 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 -
# Verdict Execution time Memory Grader output
1 Incorrect 2 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 -