目录

比赛链接:https://codeforc.es/contest/1385

pro:3.5 / 7

A

ac代码

ac代码

#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
const int maxn = 2e5 + 5;
const double pi = acos(-1);
const int mod = 998244353;
 
int x, y, z, a, b, c;
int t;
 
int main(){
	cin >> t;
	while(t--){
		cin >> x >> y >> z;
		int a = (x == y) + (x == z) + (y == z);
		if(!a){
			puts("NO");
			continue;
		}
		else if(a == 3){
			puts("YES");
			cout << x << ' ' << x << ' ' << x << endl;
			continue; 
		}
		else{
			if((x == y && z > x) || (x == z && y > x) || (y == z && x > y)) puts("NO");
			else{
				puts("YES");
				if(x == y) cout << x << ' ' << z << ' ' << z << endl;
				else if(x == z) cout << x << ' ' << y << ' ' << y << endl;
				else cout << y << ' ' << x << ' ' << x << endl;
			}
		}
	}
} 

B

ac代码

ac代码

#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
const int maxn = 2e5 + 5;
const double pi = acos(-1);
const int mod = 998244353;
 
int t;
int n;
int a[105];
 
int main(){
	cin >> t;
	while(t--){
		cin >> n;
		int tmp;
		memset(a, 0, sizeof(a));
		for(int i = 1; i <= 2 * n; ++i){
			cin >> tmp;
			if(a[tmp]) continue;
			cout << tmp << ' ';
			a[tmp] = 1;
		}
		puts("");
	}
} 

C

ac代码

ac代码

#include<bits/stdc++.h>
using namespace std;
 
typedef long long ll;
const int maxn = 2e5 + 5;
const double pi = acos(-1);
const int mod = 998244353;
 
int t;
int n;
int a[maxn];
 
int main(){
	cin >> t;
	while(t--){
		cin >> n;
		for(int i = 1; i <= n; ++i) cin >> a[i];
		if(n == 1){
			cout << 0 << endl;
			continue;
		}
		int p = -1, q = -1;
		for(int i = n; i > 1; --i){
			if(a[i-1] < a[i]){
				p = i;
				break;
			}
		}
		if(p == -1){
			cout << 0 << endl;
			continue;
		}
		for(int i = p; i > 1; --i){
			if(a[i-1] > a[i]){
				q = i;
				break;
			}
		}
		if(q == -1) cout << 0 << endl;
		else cout << q - 1 << endl;
	}
} 

D