제출 #1112455

#제출 시각아이디문제언어결과실행 시간메모리
1112455vjudge1Baloni (COCI15_baloni)C++17
60 / 100
1745 ms3664 KiB
#include <bits/stdc++.h> using namespace std; int main() { int a; int b; long long int toplam=0; scanf("%d",&a); if(a==1){ printf("1"); return 0; } vector<int> c(a); map<int,int> v; for(int i=0;i<a;i++){ scanf("%d",&c[i]); } int eleman; int sayac=a; int kontrol=1; while(kontrol){ kontrol=0; for(int i=0;i<a;i++){ if(c[i]!=0){ eleman=i; kontrol=1; break; }} int ar=1; for(int i=eleman+1;i<a;i++){ if((c[i]+ar)==c[eleman]){ sayac=sayac-1; ar=ar+1; c[i]=0; } } c[eleman]=0; } printf("%d",sayac); return 0; }

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

baloni.cpp: In function 'int main()':
baloni.cpp:9:9: warning: unused variable 'b' [-Wunused-variable]
    9 |     int b;
      |         ^
baloni.cpp:11:19: warning: unused variable 'toplam' [-Wunused-variable]
   11 |     long long int toplam=0;
      |                   ^~~~~~
baloni.cpp:12:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |     scanf("%d",&a);
      |     ~~~~~^~~~~~~~~
baloni.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |         scanf("%d",&c[i]);
      |         ~~~~~^~~~~~~~~~~~
baloni.cpp:51:17: warning: 'eleman' may be used uninitialized in this function [-Wmaybe-uninitialized]
   51 |         c[eleman]=0;
      |                 ^
#Verdict Execution timeMemoryGrader output
Fetching results...