제출 #1311255

#제출 시각아이디문제언어결과실행 시간메모리
1311255lizi14Arranging Shoes (IOI19_shoes)C++20
컴파일 에러
0 ms0 KiB
#include "shoes.h" #include <bits/stdc++.h> using namespace std; //#include "shoes.h" long long count_swaps(vector<int> s) { if(n==1){ if(s[0]<0 && s[1]>0){ return 0; } else return 1; } int cnt=0; int n=s.size()/2; for(int i=0; i<n; i++){ if(abs(s[i])==s[i+n] && s[i]<0)cnt++; } if(cnt==n){ return (n*(n-1)/2); } //return 1; }

컴파일 시 표준 에러 (stderr) 메시지

shoes.cpp: In function 'long long int count_swaps(std::vector<int>)':
shoes.cpp:8:8: error: 'n' was not declared in this scope
    8 |     if(n==1){
      |        ^
shoes.cpp:24:1: warning: control reaches end of non-void function [-Wreturn-type]
   24 | }
      | ^