제출 #83504

#제출 시각아이디문제언어결과실행 시간메모리
83504nikolapesic2802새로운 문제 (POI13_usu)C++14
100 / 100
270 ms39768 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define pb push_back /* - Find some c with k b's around add it to the answer and "delete" the c and b's. */ int main() { int n,k; scanf("%i %i",&n,&k); char s[n]; scanf("%s",s); vector<vector<int> > sol; vector<int> space; space.pb(0); int c=0; vector<int> index; for(int i=0;i<n;i++) { index.pb(i); if(s[i]=='c') { c++; space.pb(0); } else { space[c]++; } if(c&&space[c]+space[c-1]>=k) { vector<int> tr; for(int i=0;i<k+1;i++) { tr.pb(index.back()); index.pop_back(); } reverse(tr.begin(),tr.end()); sol.pb(tr); int dif=space[c--]; space.pop_back(); space[c]-=k-dif; } } reverse(sol.begin(),sol.end()); for(auto p:sol) { for(auto d:p) { printf("%i ",d+1); } printf("\n"); } return 0; }

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

usu.cpp: In function 'int main()':
usu.cpp:14:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%i %i",&n,&k);
     ~~~~~^~~~~~~~~~~~~~~
usu.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%s",s);
     ~~~~~^~~~~~~~
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...