用户工具

站点工具


2020-2021:teams:manespace:codeforces_round_656_div._3

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

后一修订版
前一修订版
2020-2021:teams:manespace:codeforces_round_656_div._3 [2020/07/24 11:18]
intouchables 创建
2020-2021:teams:manespace:codeforces_round_656_div._3 [2020/07/24 11:43] (当前版本)
intouchables [C]
行 1: 行 1:
 比赛链接:https://​codeforc.es/​contest/​1385 比赛链接:https://​codeforc.es/​contest/​1385
  
-pro:3.5/7+pro:3.5 / 7
  
-====A====+=====A=====
  
 +  *题意:多组数据,每组三个正整数$x,​ y, z$,构造$a,​ b, c$满足$x = max(a, b)$, $y = max(a, c)$, $z= max(b, c)$
 +  *题解:签到题,分类特判即可
 +<hidden ac代码>​
 +<code c++>
 +#​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;
  
-====B====+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;
 + }
 + }
 + }
 +
 +</​code>​
 +</​hidden>​
  
 +=====B=====
  
-====C====+  *题意:给定多组有且仅有两次重复的数字序列,在不影响相对顺序的前提下去重 
 +  *题解:签到题,打标记跳输出即可 
 +<hidden ac代码>​ 
 +<code c++> 
 +#​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];
  
-====D====+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(""​);​ 
 +
 +}  
 +</​code>​ 
 +</​hidden>​
  
-见本周推荐+=====C===== 
 + 
 +  *题意:定义“good”序列:每次从首位或末位拿出元素,组成的新序列单调不降。多组数据,给定序列,询问删去从首位开始的至少多少元素,可以使序列成为“good”序列? 
 +  *题解:所谓“good”序列就是从首末开始到某一位置都单调不降的序列,只需倒序遍历,先找不降序列,由此后找不升序列,统计剩余元素个数输出即可 
 +<hidden ac代码>​ 
 +<code c++> 
 +#​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; 
 +
 +}  
 +</​code>​ 
 +</​hidden>​ 
 + 
 +=====D===== 
 + 
 +  *见本周推荐
2020-2021/teams/manespace/codeforces_round_656_div._3.1595560732.txt.gz · 最后更改: 2020/07/24 11:18 由 intouchables