Warning: session_start(): open(/tmp/sess_84c1cfdbeb6f4416691f54b364a8f526, O_RDWR) failed: No space left on device (28) in /data/wiki/inc/init.php on line 239

Warning: session_start(): Failed to read session data: files (path: ) in /data/wiki/inc/init.php on line 239

Warning: Cannot modify header information - headers already sent by (output started at /data/wiki/inc/init.php:239) in /data/wiki/inc/auth.php on line 430
Writing /data/wiki/data/cache/d/de2edb2fcb553ea79b79c722a4e13dbc.captchaip failed

Warning: Cannot modify header information - headers already sent by (output started at /data/wiki/inc/init.php:239) in /data/wiki/inc/actions.php on line 38

Warning: Cannot modify header information - headers already sent by (output started at /data/wiki/inc/init.php:239) in /data/wiki/lib/tpl/dokuwiki/main.php on line 12
2020-2021:teams:manespace:codeforces_round_656_div._3 [CVBB ACM Team]

用户工具

站点工具


2020-2021:teams:manespace:codeforces_round_656_div._3

到此差别页面的链接

两侧同时换到之前的修订记录 前一修订版
后一修订版
前一修订版
2020-2021:teams:manespace:codeforces_round_656_div._3 [2020/07/24 11:19]
intouchables
2020-2021:teams:manespace:codeforces_round_656_div._3 [2020/07/24 11:43] (当前版本)
intouchables [C]
行 5: 行 5:
 =====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;
 +
 +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===== =====B=====
  
 +  *题意:给定多组有且仅有两次重复的数字序列,在不影响相对顺序的前提下去重
 +  *题解:签到题,打标记跳输出即可
 +<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];
 +
 +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===== =====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===== =====D=====
  
-见本周推荐+  *见本周推荐
2020-2021/teams/manespace/codeforces_round_656_div._3.1595560749.txt.gz · 最后更改: 2020/07/24 11:19 由 intouchables