제출 #784396

#제출 시각아이디문제언어결과실행 시간메모리
784396ZHIRDILBILDIZ밀림 점프 (APIO21_jumps)C++14
4 / 100
733 ms1820 KiB
#include<bits/stdc++.h> #include "jumps.h" using namespace std ; bool flag1, flag2 ; void init(int n, vector<int> a) { for(int i = 0 ; i < n ; i++) if(a[i] != i + 1)flag1 = 1 ; } int minimum_jumps(int a, int b, int c, int d) { if(!flag1) { if(a <= c && c <= b || a <= d && d <= b || c <= a && a <= d || a <= d && d <= b)return 0 ; if(c - b > 0)return c - b ; else return -1 ; } } //signed main() //{ // ios_base::sync_with_stdio( 0 ) ; // cin.tie( 0 ) ; // cout.tie( 0 ) ; // int n ; // cin >> n ; // vector<int> v(n) ; // for(int i = 0 ; i < n ; i++) // cin >> v[i] ; // init(n, v) ; // while() // { // int a, b, c, d ; // cin >> a >> b >> c >> d ; // } // return 0 ; //}

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

jumps.cpp: In function 'int minimum_jumps(int, int, int, int)':
jumps.cpp:14:19: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   14 |         if(a <= c && c <= b || a <= d && d <= b || c <= a && a <= d || a <= d && d <= b)return 0 ;
      |            ~~~~~~~^~~~~~~~~
jumps.cpp:14:59: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   14 |         if(a <= c && c <= b || a <= d && d <= b || c <= a && a <= d || a <= d && d <= b)return 0 ;
      |                                                    ~~~~~~~^~~~~~~~~
jumps.cpp:14:79: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
   14 |         if(a <= c && c <= b || a <= d && d <= b || c <= a && a <= d || a <= d && d <= b)return 0 ;
      |                                                                        ~~~~~~~^~~~~~~~~
jumps.cpp:18:1: warning: control reaches end of non-void function [-Wreturn-type]
   18 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...