首页 > 其他分享 >Codeforces Global Round 23-C

Codeforces Global Round 23-C

时间:2022-10-20 17:55:31浏览次数:65  
标签:ch 23 int ll Global Codeforces long include define

C

题目链接:https://codeforces.com/contest/1746/problem/C

此题着实不难,就是看你自己能不能想到那种构造的方法。自己做的时候没有很好的思路,所以参考了官方的解析()。

个人觉得官方解析不错,一步一步来的蛮好。

 1 #include<iostream>
 2 #include<cstdio>
 3 #include<string>
 4 #include<cstring>
 5 #include<algorithm>
 6 #include<cmath>
 7 #include<map>
 8 #include<vector>
 9 #define ll long long
10 #define ull unsigned long long
11 #define mem(x,y) memset(x,y,sizeof(x))
12 //#define int long long
13 
14 inline ll read()
15 {
16     ll x=0,f=1;char ch=getchar();
17     while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
18     while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
19     return x*f;
20 }
21 
22 using namespace std;
23 const int maxm=1e5+5,inf=0x3f3f3f3f;
24 int n,a[maxm],b[maxm];
25 
26 void solve(){
27     cin>>n;
28     for(int i=1;i<=n;++i) cin>>a[i];
29     int p=1;
30     for(int i=1;i<=n;++i){
31         b[a[i]]=i;
32     }
33     for(int i=1;i<n;++i){
34         if(b[i]!=n)
35             cout<<b[i]+1<<' ';
36         else cout<<1<<' ';
37     }
38     if(b[n]!=n) cout<<b[n]+1<<endl;
39     else cout<<1<<endl;
40     return ;
41 }
42 
43 signed main(){
44 //    ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
45     int _=1;
46     cin>>_;
47     while(_--){
48         solve();
49     }
50     return 0;
51 }
View Code

 

标签:ch,23,int,ll,Global,Codeforces,long,include,define
From: https://www.cnblogs.com/Qiansui/p/16810756.html

相关文章

  • 计算机RS232接口定义DB9
    左上角为1,右下角为9 DB91DCD载波检测2RXD接收数据3TXD发送数据4DTR数据终端准备好5SGND信号地线6DSR数据准备好7RTS请求发送8CTS清除发送9RI振铃提示......
  • HDU2376——Average distance(思维+树形DP)
    原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=2376原文:https://www.codenong.com/cs109682980/题意:给定一棵树,有边权,求树上任意两点之间距离的和的平均值。思路......
  • 创新洞见|2023年B2B业务为何必须采用PLG增长策略
    随着采用PLG模式的大型企业数量不断增加,91%的公司计划在2022年增加对PLG战略的投资,市场上已经验证了PLG公司的表现优于其竞争对手,规模增长更快,并拥有更高的企业价值(EV)。P......
  • Educational Codeforces Round 103 C
    C.LongestSimpleCycle显然针对ab相等的话那我们就不能再往前走了所以我们考虑分为几个层我们考虑如何求出一个层的最长环我们观察这个红色的环显然我们正着做反......
  • 最新版Photoshop 2023都有哪些新功能
    期盼已久的mac版PS2023终于来了,Photoshop2023带来了选择工具升级、一键删除和填充、邀请编辑、照片恢复神经过滤器等。安装ps2023激活版:https://www.macz.com/mac/88......
  • autocad2023 for mac中文版(cad2023三维绘图设计软件)
    autocad2023formac软件的最新功能,包括行业特定的工具集、新的自动化以及跨设备和Autodesk产品的无缝连接。AutoCAD2023forMac中文版软件介绍AutoCAD是由美国欧特克......
  • Codeforces Round #202 (Div. 1) A. Mafia 推公式 + 二分答案
    ​​http://codeforces.com/problemset/problem/348/A​​A.MafiatimelimitpertestmemorylimitpertestinputoutputOnedaynfriendsgatheredtogethertoplay"Ma......
  • bzoj 2301: [HAOI2011]Problem b mobius反演 RE
    ​​http://www.lydsy.com/JudgeOnline/problem.php?id=2301​​设f(i)为在区间[1,n]和区间[1,m]中,gcd(x,y)=i的个数。设F(i)为在区间[1,n]和区间[1,m]中,gcd(x,y)%......
  • 力扣leetcode 第2394题 求工作时间不达标的员工
    力扣leetcode第2394题求工作时间不达标的员工selectemployee_idfrom(selectDISTINCTe.employee_id,e.needed_hours*60asneeded_hours,ifnull((selectsum(......
  • drools_04_global
    关于global属性drl文件中可以设置任意多个global对象,语法是globaldataTypevariable,dataType不能是int/double等原始类型.global作用:用于Java和规则之......