Skip to content

Commit 4e2672e

Browse files
author
Jie Feng
committed
haha
1 parent acb4878 commit 4e2672e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+1143
-117
lines changed

codeforces/'

Lines changed: 0 additions & 77 deletions
This file was deleted.

codeforces/436C.cpp

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
#include <set>
1111
#include <cstdlib>
1212
#include <fstream>
13-
#include <iomanip>
14-
#include <iostream>
13+
#include <iomanip>
14+
#include <iostream>
1515
#include <sstream> // istringstream buffer(myString);
1616
#include <stack>
1717
#include <algorithm>
@@ -69,19 +69,19 @@ inline void pisz(int n) { printf("%d\n",n); }
6969
#define printV(a) printA(a,0,(int)a.size()-1);
7070
#define printVV(a) F(i,0,a.size()) {F(j,0,a[i].size())cout << a[i][j] << ' '; cout << endl;}
7171
#define MAXN 10000
72-
#define sz(a) int((a).size())
73-
#define pb push_back
74-
#define all(c) (c).begin(),(c).end()
75-
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
76-
#define present(c,x) ((c).find(x) != (c).end())
77-
#define cpresent(c,x) (find(all(c),x) != (c).end())
72+
#define sz(a) int((a).size())
73+
#define pb push_back
74+
#define all(c) (c).begin(),(c).end()
75+
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
76+
#define present(c,x) ((c).find(x) != (c).end())
77+
#define cpresent(c,x) (find(all(c),x) != (c).end())
7878
template<class T> string tos(T n) { stringstream ss; ss << n; return ss.str(); }
7979
#define tiny (double)1e-13
8080
#define close(x,y) (abs(x-y)<tiny)
8181
typedef int elem_t;
82-
typedef vector<int> vi;
83-
typedef vector<vi> vvi;
84-
typedef pair<int,int> ii;
82+
typedef vector<int> vi;
83+
typedef vector<vi> vvi;
84+
typedef pair<int,int> ii;
8585
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
8686
template<typename T> ostream& operator<<(ostream &s,vector<T> t){F(i,0,SZ(t))s<<t[i]<<" ";return s; }
8787
int gcd(int a,int b){return a?gcd(b%a,a):b;}
@@ -107,7 +107,7 @@ int diff(int t, int t1){
107107
int main ( int argc, char *argv[] ) {
108108
cin >> n >> m >> k >> w;
109109

110-
FE(t,1,k){
110+
FE(t,1,k){
111111
F(i, 0, n) getS(L[t][i]);
112112
cc[t][0] = cc[0][t] = n*m;
113113
F(t1, 1, t){
@@ -143,12 +143,3 @@ int main ( int argc, char *argv[] ) {
143143
cout << output.str() << endl;
144144
return EXIT_SUCCESS;
145145
}
146-
147-
148-
149-
150-
151-
152-
153-
154-

codeforces/442B

46.5 KB
Binary file not shown.

codeforces/442B.cpp

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#include <cmath>
2+
#include <set>
3+
#include <list>
4+
//#include <unordered_set>
5+
//#include <hash_map>
6+
#include <climits>
7+
#include <queue>
8+
#include <vector>
9+
#include <map>
10+
#include <set>
11+
#include <cstdlib>
12+
#include <fstream>
13+
#include <iomanip>
14+
#include <iostream>
15+
#include <sstream> // istringstream buffer(myString);
16+
#include <stack>
17+
#include <algorithm>
18+
#include <cstring>
19+
#include <cassert>
20+
using namespace std;
21+
#define bit(x,i) (x&(1<<i))
22+
#define lowb(t) (t &(-t))
23+
#define pow2(x) (1<<x)
24+
//#define max(a,b) (a<b?b:a)
25+
//#define abs(x) (x<0?-x:x)
26+
#define IN(i,l,r) (l<i&&i<r)
27+
#define LINR(i,l,r) (l<=i&&i<=r)
28+
#define LIN(i,l,r) (l<=i&&i<r)
29+
#define INR(i,l,r) (l<i&&i<r)
30+
#define F(i,L,R) for (int i = L; i < R; i++)
31+
#define FE(i,L,R) for (int i = L; i <= R; i++)
32+
#define FF(i,L,R) for (int i = L; i > R; i--)
33+
#define FFE(i,L,R) for (int i = L; i >= R; i--)
34+
#define char2Int(c) (c-'0')
35+
#define lastEle(vec) vec[vec.size()-1]
36+
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n))
37+
#define clr(a,x) memset(a,x,sizeof(a))
38+
#define getI(a) scanf("%d", &a)
39+
#define getII(a,b) scanf("%d%d", &a, &b)
40+
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
41+
#define getS(x) scanf("%s", x);
42+
#define SZ(x) ((int)((x).size()))
43+
#define REMAX(a,b) (a)=max((a),(b));
44+
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
45+
#define REMIN(a,b) (a)=min((a),(b));
46+
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
47+
#define ALL(t) t.begin(),t.end()
48+
#define ll long long
49+
#define ull unsigned long long
50+
#define ui unsigned int
51+
#define us unsigned short
52+
#define IOS ios_base::sync_with_stdio(0);
53+
#define pb push_back
54+
#define INF 1001001001
55+
#define PI 3.1415926535897932384626
56+
#define mp make_pair
57+
#define ll long long
58+
#define fi first
59+
#define se second
60+
#define root(x) ((int)sqrt((double)x))
61+
#define wez(n) int (n); scanf("%d",&(n));
62+
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m));
63+
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k));
64+
inline void pisz(int n) { printf("%d\n",n); }
65+
#define TESTS wez(testow)while(testow--)
66+
#define whileZ int T; getI(T); while(T--)
67+
#define printA(a,L,R) FE(i,L,R) cout << a[i] << (i==R?'\n':' ')
68+
#define printM(a,n,m) F(i,0,n){ F(j,0,m) cout << a[i][j] << ' '; cout << endl;}
69+
#define printV(a) printA(a,0,(int)a.size()-1);
70+
#define printVV(a) F(i,0,a.size()) {F(j,0,a[i].size())cout << a[i][j] << ' '; cout << endl;}
71+
#define MAXN 10000
72+
#define sz(a) int((a).size())
73+
#define pb push_back
74+
#define all(c) (c).begin(),(c).end()
75+
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
76+
#define present(c,x) ((c).find(x) != (c).end())
77+
#define cpresent(c,x) (find(all(c),x) != (c).end())
78+
template<class T> string tos(T n) { stringstream ss; ss << n; return ss.str(); }
79+
#define tiny (double)1e-13
80+
#define close(x,y) (abs(x-y)<tiny)
81+
typedef int elem_t;
82+
typedef vector<int> vi;
83+
typedef vector<vi> vvi;
84+
typedef pair<int,int> ii;
85+
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
86+
template<typename T> ostream& operator<<(ostream &s,vector<T> t){F(i,0,SZ(t))s<<t[i]<<" ";return s; }
87+
int gcd(int a,int b){return a?gcd(b%a,a):b;}
88+
ll gcd(ll a,ll b){return a?gcd(b%a,a):b;}
89+
ll powmod(ll a,ll p,ll m){ll r=1;while(p){if(p&1)r=r*a%m;p>>=1;a=a*a%m;}return r;}
90+
double p[101];
91+
int main ( int argc, char *argv[] ) {
92+
wez(n);
93+
F(i,0,n) cin >> p[i];
94+
sort(p, p+n);
95+
double p0 = 1, p1 = 0;
96+
for (int i = n-1; i >= 0; i--) if(p0 > p1){
97+
double pT = p0 * p[i] + p1 * (1-p[i]);
98+
//p0 * p[i] + p1 * (1-p[i]) > p1
99+
//p0 > p1
100+
p1 = pT;
101+
p0 = p0 * (1 - p[i]);
102+
}
103+
printf("%.14lf\n", p1);
104+
return EXIT_SUCCESS;
105+
}

codeforces/442B.o

75.3 KB
Binary file not shown.

codeforces/442D

57.8 KB
Binary file not shown.

codeforces/442D.cpp

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
#include <cmath>
2+
#include <set>
3+
#include <list>
4+
//#include <unordered_set>
5+
//#include <hash_map>
6+
#include <climits>
7+
#include <queue>
8+
#include <vector>
9+
#include <map>
10+
#include <set>
11+
#include <cstdlib>
12+
#include <fstream>
13+
#include <iomanip>
14+
#include <iostream>
15+
#include <sstream> // istringstream buffer(myString);
16+
#include <stack>
17+
#include <algorithm>
18+
#include <cstring>
19+
#include <cassert>
20+
using namespace std;
21+
#define bit(x,i) (x&(1<<i))
22+
#define lowb(t) (t &(-t))
23+
#define pow2(x) (1<<x)
24+
//#define max(a,b) (a<b?b:a)
25+
//#define abs(x) (x<0?-x:x)
26+
#define IN(i,l,r) (l<i&&i<r)
27+
#define LINR(i,l,r) (l<=i&&i<=r)
28+
#define LIN(i,l,r) (l<=i&&i<r)
29+
#define INR(i,l,r) (l<i&&i<r)
30+
#define F(i,L,R) for (int i = L; i < R; i++)
31+
#define FE(i,L,R) for (int i = L; i <= R; i++)
32+
#define FF(i,L,R) for (int i = L; i > R; i--)
33+
#define FFE(i,L,R) for (int i = L; i >= R; i--)
34+
#define char2Int(c) (c-'0')
35+
#define lastEle(vec) vec[vec.size()-1]
36+
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n))
37+
#define clr(a,x) memset(a,x,sizeof(a))
38+
#define getI(a) scanf("%d", &a)
39+
#define getII(a,b) scanf("%d%d", &a, &b)
40+
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
41+
#define getS(x) scanf("%s", x);
42+
#define SZ(x) ((int)((x).size()))
43+
#define REMAX(a,b) (a)=max((a),(b));
44+
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
45+
#define REMIN(a,b) (a)=min((a),(b));
46+
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
47+
#define ALL(t) t.begin(),t.end()
48+
#define ll long long
49+
#define ull unsigned long long
50+
#define ui unsigned int
51+
#define us unsigned short
52+
#define IOS ios_base::sync_with_stdio(0);
53+
#define pb push_back
54+
#define INF 1001001001
55+
#define PI 3.1415926535897932384626
56+
#define mp make_pair
57+
#define ll long long
58+
#define fi first
59+
#define se second
60+
#define root(x) ((int)sqrt((double)x))
61+
#define wez(n) int (n); scanf("%d",&(n));
62+
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m));
63+
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k));
64+
inline void pisz(int n) { printf("%d\n",n); }
65+
#define TESTS wez(testow)while(testow--)
66+
#define whileZ int T; getI(T); while(T--)
67+
#define printA(a,L,R) FE(i,L,R) cout << a[i] << (i==R?'\n':' ')
68+
#define printM(a,n,m) F(i,0,n){ F(j,0,m) cout << a[i][j] << ' '; cout << endl;}
69+
#define printV(a) printA(a,0,(int)a.size()-1);
70+
#define printVV(a) F(i,0,a.size()) {F(j,0,a[i].size())cout << a[i][j] << ' '; cout << endl;}
71+
#define MAXN 10000
72+
#define sz(a) int((a).size())
73+
#define pb push_back
74+
#define all(c) (c).begin(),(c).end()
75+
#define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++)
76+
#define present(c,x) ((c).find(x) != (c).end())
77+
#define cpresent(c,x) (find(all(c),x) != (c).end())
78+
template<class T> string tos(T n) { stringstream ss; ss << n; return ss.str(); }
79+
#define tiny (double)1e-13
80+
#define close(x,y) (abs(x-y)<tiny)
81+
typedef int elem_t;
82+
typedef vector<int> vi;
83+
typedef vector<vi> vvi;
84+
typedef pair<int,int> ii;
85+
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
86+
template<typename T> ostream& operator<<(ostream &s,vector<T> t){F(i,0,SZ(t))s<<t[i]<<" ";return s; }
87+
int gcd(int a,int b){return a?gcd(b%a,a):b;}
88+
ll gcd(ll a,ll b){return a?gcd(b%a,a):b;}
89+
ll powmod(ll a,ll p,ll m){ll r=1;while(p){if(p&1)r=r*a%m;p>>=1;a=a*a%m;}return r;}
90+
#define N 1000009
91+
int n;
92+
vector<int> sons[N];
93+
int fa[N];
94+
int br[N];
95+
int main ( int argc, char *argv[] ) {
96+
clr(fa, 0);
97+
clr(br, 0);
98+
cin >> n;
99+
int maxBr = 0;
100+
FE(i,2,n+1){
101+
wez(x);
102+
fa[i] = x;
103+
sons[x].push_back(i);
104+
while(x != 0){
105+
int cnt = 0;
106+
int b = -1;
107+
F(j,0,sons[x].size()){
108+
int s = sons[x][j];
109+
if (br[s] > b){
110+
b = br[s];
111+
cnt = 1;
112+
}else if (br[s] == b){
113+
cnt++;
114+
}
115+
}
116+
if (cnt > 1)
117+
br[x] = b+1;
118+
else br[x] = b;
119+
x = fa[x];
120+
}
121+
122+
if (br[1] == 0) cout << 1;
123+
else cout << br[1];
124+
if (i == n+1) cout << endl;
125+
else cout << ' ';
126+
}
127+
return EXIT_SUCCESS;
128+
}

codeforces/442D.o

119 KB
Binary file not shown.

codeforces/in

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,2 @@
1-
5 3
2-
0 2 4
3-
1 3 1
4-
0 8 3
5-
0 20 10
6-
1 5 5
1+
11
2+
1 1 1 3 4 4 7 3 7 6 6

codeforces/makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
target= 436A
1+
target= 442D
22

33
all:
44
g++ -o $(target) -g $(target).cpp -w

0 commit comments

Comments
 (0)