제출 #1112382

#제출 시각아이디문제언어결과실행 시간메모리
1112382vjudge1Baloni (COCI15_baloni)C++11
40 / 100
2084 ms3664 KiB
#include <bits/stdc++.h> int main() { int n,count = 0; int max=0,index=0; std::cin >> n; std::vector<int> arr(n,0); for(int &i:arr) std::cin >> i; std::queue<int> q; while(arr.size()>0) { int balon=arr[0]; count++; for(int i=0;i<arr.size();i++) { if(arr[i]==balon) { q.push(i); balon--; } if(balon==0) break; } int katsayi=0; while(!q.empty()) { int x = q.front(); q.pop(); arr.erase(arr.begin()+x-katsayi); katsayi++; } } std::cout << count; }

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

baloni.cpp: In function 'int main()':
baloni.cpp:26:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |         for(int i=0;i<arr.size();i++)
      |                     ~^~~~~~~~~~~
baloni.cpp:11:9: warning: unused variable 'max' [-Wunused-variable]
   11 |     int max=0,index=0;
      |         ^~~
baloni.cpp:11:15: warning: unused variable 'index' [-Wunused-variable]
   11 |     int max=0,index=0;
      |               ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...