제출 #1327602

#제출 시각아이디문제언어결과실행 시간메모리
1327602d_kSličnost (COI23_slicnost)C++20
7 / 100
3094 ms1080 KiB
				/*Bismillahir Rahmanir Raheem*/
#include <bits/stdc++.h>
using namespace std;

#define int long long
#define F first
#define S second
#define pb push_back

const int inf = 1e9 + 7;
const int N = 5e5 + 5;
const int MOD = 1e9 + 7;

void ma1n() {
	int n, k, q;
	cin>>n>>k>>q;
	vector<int> a(n + 1), b(n + 1);
	for(int i = 1; i <= n; i++) cin>>a[i];
	for(int i = 1; i <= n; i++) cin>>b[i];
	vector<vector<int> > col1, col2;
	for(int i = k; i <= n; i++){
		vector<int> c1, c2;
		for(int j = i - k + 1; j <= i; j++){
			c1.pb(a[j]); c2.pb(b[j]);
		}
		sort(c1.begin(), c1.end());
		sort(c2.begin(), c2.end());
		col1.pb(c1); col2.pb(c2);
	}
	int mx = 0, col = 0;
	for(int i = 0; i < col1.size(); i++){
		for(int j = 0; j < col2.size(); j++){
			int num = 0;
			for(int k = 1; k <= n; k++){
				auto it1 = find(col1[i].begin(), col1[i].end(), k);
				auto it2 = find(col2[j].begin(), col2[j].end(), k);
				if(it1 != col1[i].end() and it2 != col2[j].end()){
					num ++;
				}
			}
			if(mx == num) col++;
			if(mx < num){
				col = 1;
				mx = num;
			}
		}
	}
	cout<<mx<<" "<<col<<"\n";
}

main() {
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);

	int T = 1;
//	cin >> T;
	while(T--) {
		ma1n();
	}
	return 0;
}

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

Main.cpp:51:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   51 | main() {
      | ^~~~
#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...