제출 #1059204

#제출 시각아이디문제언어결과실행 시간메모리
1059204vjudge1로봇 (IOI13_robots)C++17
0 / 100
1 ms348 KiB
#include "robots.h" #include<bits/stdc++.h> #define ll long long using namespace std; int putaway(int A, int B, int T, int X[], int Y[], int W[], int S[]) { vector<pair<int,int>> Tw, Ts; for(int i=0; i < T; i++){ Tw.push_back({W[i],S[i]}); Ts.push_back({S[i],W[i]}); } sort(Tw.rbegin(),Tw.rend()); sort(Ts.rbegin(),Ts.rend()); int r1=0,r2=0; if(A == 2){ for(int i=0; i < T; i++){ if(Tw[i].first < X[0]){ r1++; } if(Tw[i].first < X[1]){ r2++; } } }else if(B == 2){ for(int i=0; i < T; i++){ if(Ts[i].first < Y[0]){ r1++; } if(Ts[i].first < Y[1]){ r2++; } } }else{ for(int i=0; i < T; i++){ if(Tw[i].first < X[0]){ r1++; } } for(int i=0; i < T; i++){ if(Ts[i].first < Y[0]){ r2++; } } } int ans=-1; if((r1 == 2 && r2 >= 0) || (r2 == 2 && r1 >= 0)){ ans = 1; }else if(r1 == 1 && r2 == 1){ int a,b; for(int i=0; i < T; i++){ if(Tw[i].first < X[0]){ a = i; } if(Tw[i].second < Y[0]){ b = i; } } if(a != b){ ans = 1; }else{ ans = 2; } } return ans; }

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

robots.cpp: In function 'int putaway(int, int, int, int*, int*, int*, int*)':
robots.cpp:61:9: warning: 'b' may be used uninitialized in this function [-Wmaybe-uninitialized]
   61 |         if(a != b){
      |         ^~
robots.cpp:61:9: warning: 'a' may be used uninitialized in this function [-Wmaybe-uninitialized]
#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...