Submission #82674

# Submission time Handle Problem Language Result Execution time Memory
82674 2018-11-01T09:44:00 Z farukkastamonuda Take-out (POI13_usu) C++14
0 / 100
236 ms 38212 KB
#include <bits/stdc++.h>
#define fi first
#define se second
#define lo long long 
#define inf 1000000009
#define md 1000000007
#define li 1000005
#define mp make_pair
#define pb push_back
using namespace std;
int n,k,cev,bas1,bas2,c;
char s[li];
vector<int> v,p;
vector< vector<int> > ans;
int main(){
	scanf("%d %d",&n,&k);
	scanf("%s",s+1);
	p.pb(0);
	for(int i=1;i<=n;i++){
		v.pb(i);
		if(s[i]=='c'){
			c++;
			p.pb(0);
		}
		else p[c]++;
		if(c && p[c]+p[c-1]>=k){
			vector<int> T;
			for(int j=1;j<=k+1;j++){
				T.pb(v.back());
				v.pop_back();
			}
			reverse(T.begin(),T.end());
			ans.pb(T);
			int X=p[c--];
			p.pop_back();
			p[c]-=k-X;
		}
	}
	for(int i=0;i<(int)ans.size();i++){
		for(int j=0;j<(int)ans[i].size();j++){
			printf("%d ",ans[i][j]);
		}
		printf("\n");
	}
	return 0;
}

Compilation message

usu.cpp: In function 'int main()':
usu.cpp:16:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&n,&k);
  ~~~~~^~~~~~~~~~~~~~~
usu.cpp:17:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%s",s+1);
  ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Incorrect 2 ms 500 KB Ruch numer 5 nie jest poprawny.
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 548 KB Ruch numer 10 nie jest poprawny.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 636 KB Ruch numer 200 nie jest poprawny.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 640 KB Output is correct
2 Incorrect 3 ms 640 KB Ruch numer 9 nie jest poprawny.
# Verdict Execution time Memory Grader output
1 Incorrect 22 ms 2812 KB Ruch numer 10000 nie jest poprawny.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 32 ms 3852 KB Ruch numer 10002 nie jest poprawny.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 60 ms 7548 KB Ruch numer 5000 nie jest poprawny.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 89 ms 10376 KB Ruch numer 4000 nie jest poprawny.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 236 ms 38212 KB Ruch numer 500000 nie jest poprawny.
2 Halted 0 ms 0 KB -