답안 #1042182

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1042182 2024-08-02T15:45:21 Z raphaelp 고대 책들 (IOI17_books) C++14
컴파일 오류
0 ms 0 KB
#include<bits/stdc++.h>
using namespace std;
int64 minimum_walk(int[] p, int S){ 
  int N=p.size();  
  int64 ans=0;  
  for (int i=0; i<N; i++) 
  {    ans+=abs(i-p[i]);  }   vector<int>occ(N); 
  for(int i=0; i<N; i++)  {    if(occ[i])continue; 
    int x=i;    
                           ans+=2;    while(!occ[x])    {      occ[x]=1;      x=p[x];    }   return ans-2;}

Compilation message

books.cpp:7:5: error: extended character   is not valid in an identifier
    7 |   {    ans+=abs(i-p[i]);  }   vector<int>occ(N);
      |     ^
books.cpp:7:8: error: extended character   is not valid in an identifier
    7 |   {    ans+=abs(i-p[i]);  }   vector<int>occ(N);
      |       ^
books.cpp:7:31: error: extended character   is not valid in an identifier
    7 |   {    ans+=abs(i-p[i]);  }   vector<int>occ(N);
      |                             ^
books.cpp:8:29: error: extended character   is not valid in an identifier
    8 |   for(int i=0; i<N; i++)  {    if(occ[i])continue;
      |                             ^
books.cpp:8:32: error: extended character   is not valid in an identifier
    8 |   for(int i=0; i<N; i++)  {    if(occ[i])continue;
      |                               ^
books.cpp:9:2: error: extended character   is not valid in an identifier
    9 |     int x=i;    
      |  ^
books.cpp:9:5: error: extended character   is not valid in an identifier
    9 |     int x=i;    
      |    ^
books.cpp:9:16: error: extended character   is not valid in an identifier
    9 |     int x=i;    
      |              ^
books.cpp:9:19: error: extended character   is not valid in an identifier
    9 |     int x=i;    
      |                ^
books.cpp:10:36: error: extended character   is not valid in an identifier
   10 |                            ans+=2;    while(!occ[x])    {      occ[x]=1;      x=p[x];    }   return ans-2;}
      |                                    ^
books.cpp:10:39: error: extended character   is not valid in an identifier
   10 |                            ans+=2;    while(!occ[x])    {      occ[x]=1;      x=p[x];    }   return ans-2;}
      |                                      ^
books.cpp:10:56: error: extended character   is not valid in an identifier
   10 |                            ans+=2;    while(!occ[x])    {      occ[x]=1;      x=p[x];    }   return ans-2;}
      |                                                      ^
books.cpp:10:62: error: extended character   is not valid in an identifier
   10 |                            ans+=2;    while(!occ[x])    {      occ[x]=1;      x=p[x];    }   return ans-2;}
      |                                                           ^
books.cpp:10:65: error: extended character   is not valid in an identifier
   10 |                            ans+=2;    while(!occ[x])    {      occ[x]=1;      x=p[x];    }   return ans-2;}
      |                                                             ^
books.cpp:10:68: error: extended character   is not valid in an identifier
   10 |                            ans+=2;    while(!occ[x])    {      occ[x]=1;      x=p[x];    }   return ans-2;}
      |                                                               ^
books.cpp:10:80: error: extended character   is not valid in an identifier
   10 |                            ans+=2;    while(!occ[x])    {      occ[x]=1;      x=p[x];    }   return ans-2;}
      |                                                                          ^
books.cpp:10:83: error: extended character   is not valid in an identifier
   10 |                            ans+=2;    while(!occ[x])    {      occ[x]=1;      x=p[x];    }   return ans-2;}
      |                                                                            ^
books.cpp:10:86: error: extended character   is not valid in an identifier
   10 |                            ans+=2;    while(!occ[x])    {      occ[x]=1;      x=p[x];    }   return ans-2;}
      |                                                                              ^
books.cpp:10:96: error: extended character   is not valid in an identifier
   10 |                            ans+=2;    while(!occ[x])    {      occ[x]=1;      x=p[x];    }   return ans-2;}
      |                                                                                       ^
books.cpp:10:102: error: extended character   is not valid in an identifier
   10 |                            ans+=2;    while(!occ[x])    {      occ[x]=1;      x=p[x];    }   return ans-2;}
      |                                                                                            ^
books.cpp:3:1: error: 'int64' does not name a type; did you mean 'int64_t'?
    3 | int64 minimum_walk(int[] p, int S){
      | ^~~~~
      | int64_t