Skip to content

Commit d5d70c6

Browse files
committed
scacsaa
1 parent 65cac18 commit d5d70c6

37 files changed

Lines changed: 1338 additions & 117 deletions

.vscode/settings.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"files.associations": {
3-
"iostream": "cpp"
3+
"iostream": "cpp",
4+
"*.tcc": "cpp"
45
},
56
"competitive-programming-helper.firstTime": false
67
}

1328D.cpp

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
//https://codeforces.com/contest/1328/problem/D
21
#include<bits/stdc++.h>
32
using namespace std;
43

@@ -10,27 +9,43 @@ using namespace std;
109

1110
const long long INF = 1e18;
1211
const long long MAX = 1e5+10;
13-
int col[2*MAX]={0};
14-
vector<int>adj[MAX];
12+
1513
int main(){
1614
fastio;
17-
int t; cin>>t;
15+
int t; cin>>t;
1816
while(t--){
19-
int n; cin>>n;
20-
vector<int>a(n+1); cin>>a[0];
21-
FOR(i,1,n) { cin>>a[i]; adj[a[i-1]].push_back(a[i]); } a[n]=a[0];
22-
vector<int>temp = a;
23-
auto it = unique(temp.begin(),temp.end());
24-
temp.resize(distance(temp.begin(),it));
25-
int c=1;col[temp[0]]=1;
26-
FOR(i,1,temp.size()) {
27-
if(col[temp[i]]==0){
28-
29-
}
17+
int n; cin>>n; int a[n+1]; set<int>s;
18+
FOR(i,0,n) {cin>>a[i];s.insert(a[i]);} a[n]=a[0];
19+
if(s.size()==1){
20+
cout<<1<<"\n";
21+
FOR(i,0,n) cout<<1<<" ";
22+
}
23+
else if(n%2==0){
24+
cout<<2<<"\n";
25+
FOR(i,0,n/2) cout<<1<<" "<<2<<" ";
3026
}
31-
cout<<c<<"\n";
32-
FOR(i,0,n) cout<<col[a[i]]<<" ";
33-
cout<<"\n";
34-
FOR(i,0,temp.size()) {adj[temp[i]].clear();col[a[i]]=0;}
27+
else if(n & 1){
28+
bool x =true;int j=-1;
29+
FOR(i,1,n+1) if(a[i]==a[i-1]){ x=false; j=i-1; break; } // cout<<j<<"S";
30+
if(x) {
31+
cout<<3<<"\n";
32+
FOR(i,0,n/2) cout<<1<<" "<<2<<" ";
33+
cout<<3;
34+
}
35+
else {
36+
cout<<2<<"\n";
37+
FOR(i,0,j) if(i%2==0) cout<<1<<" "; else cout<<2<<" ";
38+
if(j%2) {
39+
cout<<2<<" ";
40+
FOR(i,j+1,n) if(i%2==0) cout<<2<<" "; else cout<<1<<" ";
41+
}
42+
else {
43+
cout<<1<<" ";
44+
FOR(i,j+1,n) if(i%2==0) cout<<2<<" "; else cout<<1<<" ";
45+
}
46+
}
47+
48+
}
49+
cout<<"\n";
3550
}
3651
}

1328D.cpp.tcs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
[{"input":"1\n8\n13 13 9 12 13 1 13 1","output":"2\n1 2 1 2 2\n2\n2 1 2 1 2 1\n3\n2 3 2 3 1\n1\n1 1 1"}]
1+
[{"input":"1\n3\n1 1 2","output":"2\n2 1 1 2 1 2 1"}]

LISlog.cpp

Whitespace-only changes.

a.out

4.96 KB
Binary file not shown.

abc159.cpp

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/* |\ | | ||\ \ /(_~ |~)|_~|\/||_~|\/||~)|_~|~)
2+
|~\|_|/\||~\ | ,_) |~\|__| ||__| ||_)|__|~\
3+
4+
\ //~\| | |\ |~)|_~ | ||\ ||/~\| ||_~
5+
| \_/\_/ |~\|~\|__ \_/| \||\_X\_/|__
6+
(J U S T L I K E E V E R Y O N E E L S E !)
7+
8+
__ ,..---.._
9+
+''''`--''-..`--..__
10+
.\ _,/:i--._`:-:+._`.``-._
11+
/`.._,,' \ `-.``--:.b....=.
12+
|`..__,,..`. '`.__::i--.-::_
13+
)- .....--i'\.. --+`'''-'
14+
,' .'.._,.-'|._-b\
15+
/,'<' V `oi| \ _.
16+
|/ -|,--.." ,'-. ||\.. _.,;:'_<'
17+
''/ | . ' |\||'\ /-'_/' `.
18+
|,','| , . .-.|:.`. + .,:.. |
19+
._,:'/ /-\ '^' -Y"\ |.| || /,+8d| |
20+
.|/,'| |/':: ':=:' ,'| | | \|| "+)=' |
21+
|+,';' /|_/ \ _/ \b':.\ \'| .|| ,'
22+
,,:-i''_i' | ``-.Y',. ,|`: | \;- | |_,'
23+
__ |'| |i:'._ ,' ,' ,; | |-)-' __--:b__
24+
.P| | |/,'|\ - ._ / / _,Y- ,:/' `. `'".._
25+
,'|| -','' | ._i._ `':| ,..,' ,Y;' \ `- ._
26+
|||||,.. | \ '-.._ _,' / _,b-' `. '-.
27+
||||P..i, .| '....,-' _,'''''-''' ' _,.. `\
28+
+'` <'/ |`-.....---' ._ ,._
29+
| | ,'``,:-''''/,--`.
30+
Y|.b_,,: | || ,;,Y' / |.
31+
,' /'----' .'| .. | | '" .`Y' .,-b_....;;,.
32+
|+|,' | | \., ' ,' `:. _ ,/__` _=: _,'``-
33+
/ +,' | /\_........:.' '"----:::::'Y .'.| |||
34+
|' ' .'/- \ /'|| || | |||
35+
||| /| \L /'|| ||/ | |||
36+
`.| ,'/ .| / ,'||/o;/ |||
37+
`..._,, | |/| ' |||
38+
``-' | |, |||
39+
| ,. | |||
40+
,=--------.... | "" | |||
41+
,/,'. i=..+._ ,.. '..;---:::''- | |
42+
'/| __....b `-''`---....../.,Y'''''j:.,.._ | `._
43+
.' _.Y.-' `.. ii:,'--------' | :-+. .| | b\
44+
| .=_,.---'''''--...:..--:' / _..-----..:= | | '|\
45+
| '-''`'--- ---'_,,,--'' `,.. | | \.
46+
\ . ,' _,--'' :dg: _,/ ||| | \
47+
`::b\` _,-i,-' ,..---' ,|:| | _|
48+
`'--.:-._ ____,,,;.,'' `--._ '''''''' |'|' .' '
49+
``'--....Y''-' `''--..._..____._____...,' | 'o-'
50+
`''''`'''i==_+=_=i__
51+
||'''- ' `.
52+
`-.......-''
53+
*/
54+
#include<bits/stdc++.h>
55+
using namespace std;
56+
57+
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
58+
#define LL long long
59+
#define mod 998244353
60+
#define FOR(i, j, k) for (int i=j ; i<k ; i++)
61+
#define ROF(i, j, k) for (int i=j ; i>=k ; i--)
62+
63+
const long long INF = 1e18;
64+
const long long MAX = 1e5+10;
65+
66+
int main(){
67+
fastio;
68+
int t=1; //cin>>t;
69+
while(t--){
70+
int n; cin>>n; LL a[n],cnt[2*MAX]={0};
71+
FOR(i,0,n) {cin>>a[i]; cnt[a[i]]++;}
72+
LL l=0;
73+
FOR(i,0,2*MAX) l+=((cnt[i]-1)*cnt[i])/2;
74+
FOR(i,0,n){
75+
cout<<l-cnt[a[i]]+1<<"\n";
76+
}
77+
}
78+
}

abc159.cpp.tcs

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

at.cpp

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/* |\ | | ||\ \ /(_~ |~)|_~|\/||_~|\/||~)|_~|~)
2+
|~\|_|/\||~\ | ,_) |~\|__| ||__| ||_)|__|~\
3+
4+
\ //~\| | |\ |~)|_~ | ||\ ||/~\| ||_~
5+
| \_/\_/ |~\|~\|__ \_/| \||\_X\_/|__
6+
(J U S T L I K E E V E R Y O N E E L S E !)
7+
8+
__ ,..---.._
9+
+''''`--''-..`--..__
10+
.\ _,/:i--._`:-:+._`.``-._
11+
/`.._,,' \ `-.``--:.b....=.
12+
|`..__,,..`. '`.__::i--.-::_
13+
)- .....--i'\.. --+`'''-'
14+
,' .'.._,.-'|._-b\
15+
/,'<' V `oi| \ _.
16+
|/ -|,--.." ,'-. ||\.. _.,;:'_<'
17+
''/ | . ' |\||'\ /-'_/' `.
18+
|,','| , . .-.|:.`. + .,:.. |
19+
._,:'/ /-\ '^' -Y"\ |.| || /,+8d| |
20+
.|/,'| |/':: ':=:' ,'| | | \|| "+)=' |
21+
|+,';' /|_/ \ _/ \b':.\ \'| .|| ,'
22+
,,:-i''_i' | ``-.Y',. ,|`: | \;- | |_,'
23+
__ |'| |i:'._ ,' ,' ,; | |-)-' __--:b__
24+
.P| | |/,'|\ - ._ / / _,Y- ,:/' `. `'".._
25+
,'|| -','' | ._i._ `':| ,..,' ,Y;' \ `- ._
26+
|||||,.. | \ '-.._ _,' / _,b-' `. '-.
27+
||||P..i, .| '....,-' _,'''''-''' ' _,.. `\
28+
+'` <'/ |`-.....---' ._ ,._
29+
| | ,'``,:-''''/,--`.
30+
Y|.b_,,: | || ,;,Y' / |.
31+
,' /'----' .'| .. | | '" .`Y' .,-b_....;;,.
32+
|+|,' | | \., ' ,' `:. _ ,/__` _=: _,'``-
33+
/ +,' | /\_........:.' '"----:::::'Y .'.| |||
34+
|' ' .'/- \ /'|| || | |||
35+
||| /| \L /'|| ||/ | |||
36+
`.| ,'/ .| / ,'||/o;/ |||
37+
`..._,, | |/| ' |||
38+
``-' | |, |||
39+
| ,. | |||
40+
,=--------.... | "" | |||
41+
,/,'. i=..+._ ,.. '..;---:::''- | |
42+
'/| __....b `-''`---....../.,Y'''''j:.,.._ | `._
43+
.' _.Y.-' `.. ii:,'--------' | :-+. .| | b\
44+
| .=_,.---'''''--...:..--:' / _..-----..:= | | '|\
45+
| '-''`'--- ---'_,,,--'' `,.. | | \.
46+
\ . ,' _,--'' :dg: _,/ ||| | \
47+
`::b\` _,-i,-' ,..---' ,|:| | _|
48+
`'--.:-._ ____,,,;.,'' `--._ '''''''' |'|' .' '
49+
``'--....Y''-' `''--..._..____._____...,' | 'o-'
50+
`''''`'''i==_+=_=i__
51+
||'''- ' `.
52+
`-.......-''
53+
*/
54+
#include<bits/stdc++.h>
55+
using namespace std;
56+
57+
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
58+
#define LL long long
59+
#define mod 998244353
60+
#define FOR(i, j, k) for (int i=j ; i<k ; i++)
61+
#define ROF(i, j, k) for (int i=j ; i>=k ; i--)
62+
63+
const long long INF = 1e18;
64+
const long long MAX = 1e5+10;
65+
66+
int main(){
67+
fastio;
68+
int t=1; //cin>>t;
69+
while(t--){
70+
int x,y,A,B,C; cin>>x>>y>>A>>B>>C;
71+
int a[A],b[B],c[C]; FOR(i,0,A) cin>>a[i]; FOR(i,0,B) cin>>b[i]; FOR(i,0,C) cin>>c[i];
72+
sort(a,a+A,greater<int>()); sort(b,b+B,greater<int>()); sort(c,c+C,greater<int>());
73+
int i=x-1,k=0; LL ans = 0;
74+
vector<LL> s;
75+
FOR(i,0,x) s.push_back(a[i]); FOR(i,0,y) s.push_back(b[i]);
76+
sort(s.begin(),s.end()); i=0;
77+
while(k<C && i<x+y){
78+
if(s[i]<c[k]) {ans+=c[k];k++; i++; }
79+
else break;
80+
}
81+
while(i<x+y) {ans+=s[i];i++;}
82+
cout<<ans;
83+
}
84+
}

at.cpp.tcs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
[{"input":"2 2 4 4 4\n11 12 13 14\n21 22 23 24\n1 2 3 4","output":""}]

at160B.cpp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
4+
#define fastio ios_base::sync_with_stdio(0); cin.tie(0)
5+
#define LL long long
6+
#define mod 998244353
7+
#define FOR(i, j, k) for (int i=j ; i<k ; i++)
8+
#define ROF(i, j, k) for (int i=j ; i>=k ; i--)
9+
10+
const long long INF = 1e18;
11+
const long long MAX = 1e5+10;
12+
13+
int main(){
14+
fastio;
15+
int n,x,y; cin>>n>>x>>y;
16+
map<int,int>m;
17+
FOR(i,1,n+1){
18+
FOR(j,i+1,n+1){
19+
int d = min(abs(y-j)+abs(x-i)+1,abs(j-i));
20+
m[d]++;
21+
}
22+
}
23+
FOR(i,1,n) cout<<m[i]<<"\n";
24+
}

0 commit comments

Comments
 (0)