QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#569485#9310. Permutation Counting 4chen-xiWA 0ms3740kbC++20925b2024-09-16 23:33:392024-09-16 23:33:39

Judging History

你现在查看的是最新测评结果

  • [2024-09-18 14:56:40]
  • hack成功,自动添加数据
  • (/hack/835)
  • [2024-09-18 14:41:06]
  • hack成功,自动添加数据
  • (/hack/831)
  • [2024-09-17 12:14:52]
  • hack成功,自动添加数据
  • (/hack/825)
  • [2024-09-16 23:33:39]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3740kb
  • [2024-09-16 23:33:39]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl "\n"
const int N = 2003;
int n;
int a[N];
vector<int> v;
bool check(int x){
	if(v[(n+1)/2]>x){
		return false;
	}
	else{
		return true;
	}
}
void solve(){
	cin>>n;
	v.clear();
	for(int i = 1;i<=n;i++){
		cin>>a[i];
	}
	sort(a+1,a+1+n);
	
	for(int i = 1;i<=n;i++){
		int l = i,r = i;
		while(l>=1 && r<n){
			v.push_back(a[i]);
			v.push_back(a[i]);
			l--,r++;
			
		}
		if(r == n && l>=1){
			v.push_back(a[i]);
		}
	}
//	int l = 1,r = 1e9+10;
//	while(l<r){
//		int mid = (l+r+1)>>1;
//		if(check(mid)){
//			l = mid;
//		}
//		else{
//			r = mid-1;
//		}
//	}
	cout<<v[(v.size()+1)/2]<<endl;
}
//3 3 3 4 5 5 8 8
//3 3 3 3 3 3 4 4 3 3 3 3 4 4 5 3 3 4 4 5 5 4 4 5 5 5 10(>5)
signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0),cout.tie(0);
	int t =1 ;
	while(t--){
		solve();
	}
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3740kb

input:

4
5
1 2
1 5
1 2
1 2
2 2
5
1 1
2 4
2 3
5 5
3 4
5
3 5
1 2
3 4
3 5
3 3
5
1 5
1 4
4 5
5 5
1 2

output:

1

result:

wrong answer 1st words differ - expected: '0', found: '1'