답안 #72914

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
72914 2018-08-27T08:25:57 Z duckmoon99 Lottery (CEOI18_lot) C++14
25 / 100
1717 ms 33792 KB
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key
#define INF 1e18
#define ret return

typedef long long ll;
typedef pair<int,int> ii;
typedef vector<int> vi;
typedef vector < pair<int, int> > vii;
typedef long double ld;
typedef tree<pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

ll a[11111];
map <deque<int>, unordered_set<int> > mm;

int main(){
    ios_base::sync_with_stdio(0); cin.tie(0);
    ll n, l, k;
    cin >> n >> l;
    for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	int q;
	cin >> q;
	
	if(n<=300){
	while(q--){
		cin >> k;
		for(int i = 0; i < n-l+1; i++){
			int ans = 0;
			for(int j = 0; j < n-l+1; j++){
				if(i!=j){
					int cnt = 0;
					for(int m = 0; m < l; m++){
						if(a[i+m]==a[j+m]){
							cnt++;
						}
					}
					if(cnt>=l-k)ans++;
				}
			}
			cout << ans << " ";
		}
		cout << '\n';
	}
	}
	else{
		cin >> k;
		deque <int> qq;
		for(int i = 0; i < l; i++){
			qq.pb(a[i]);
		}
		/*for(int j = 0; j < qq.size(); j++){
				cout << qq[j] << " ";
			}
			cout << endl;*/
		mm[qq].insert(0);
		for(int i = l; i < n; i++){
			qq.pb(a[i]);
			qq.pop_front();
			/*for(int j = 0; j < qq.size(); j++){
				cout << qq[j] << " ";
			}
			cout << endl;*/
			mm[qq].insert(i-l+1);
		}
		int ans[11111];
		for(auto it: mm){
			for(auto itt: it.se){
				ans[itt]=it.se.size()-1;
			}
		}
		for(int i = 0; i < n-l+1; i++){
			cout << ans[i] << " ";
		}
		
	}
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 10 ms 356 KB Output is correct
3 Correct 8 ms 560 KB Output is correct
4 Correct 3 ms 564 KB Output is correct
5 Correct 4 ms 564 KB Output is correct
6 Correct 4 ms 564 KB Output is correct
7 Correct 5 ms 564 KB Output is correct
8 Correct 120 ms 572 KB Output is correct
9 Correct 81 ms 624 KB Output is correct
10 Correct 67 ms 652 KB Output is correct
11 Correct 54 ms 676 KB Output is correct
12 Correct 101 ms 676 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 10 ms 356 KB Output is correct
3 Correct 8 ms 560 KB Output is correct
4 Correct 3 ms 564 KB Output is correct
5 Correct 4 ms 564 KB Output is correct
6 Correct 4 ms 564 KB Output is correct
7 Correct 5 ms 564 KB Output is correct
8 Correct 120 ms 572 KB Output is correct
9 Correct 81 ms 624 KB Output is correct
10 Correct 67 ms 652 KB Output is correct
11 Correct 54 ms 676 KB Output is correct
12 Correct 101 ms 676 KB Output is correct
13 Incorrect 7 ms 2088 KB Output isn't correct
14 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 2088 KB Output is correct
2 Correct 11 ms 2088 KB Output is correct
3 Correct 15 ms 2088 KB Output is correct
4 Correct 41 ms 4224 KB Output is correct
5 Execution timed out 1717 ms 33792 KB Time limit exceeded (wall clock)
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 2088 KB Output is correct
2 Correct 11 ms 2088 KB Output is correct
3 Correct 15 ms 2088 KB Output is correct
4 Correct 41 ms 4224 KB Output is correct
5 Execution timed out 1717 ms 33792 KB Time limit exceeded (wall clock)
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 10 ms 356 KB Output is correct
3 Correct 8 ms 560 KB Output is correct
4 Correct 3 ms 564 KB Output is correct
5 Correct 4 ms 564 KB Output is correct
6 Correct 4 ms 564 KB Output is correct
7 Correct 5 ms 564 KB Output is correct
8 Correct 120 ms 572 KB Output is correct
9 Correct 81 ms 624 KB Output is correct
10 Correct 67 ms 652 KB Output is correct
11 Correct 54 ms 676 KB Output is correct
12 Correct 101 ms 676 KB Output is correct
13 Incorrect 7 ms 2088 KB Output isn't correct
14 Halted 0 ms 0 KB -