Skip to content

Commit 7ab5131

Browse files
author
Jie Feng
committed
haha
1 parent 6cde45e commit 7ab5131

32 files changed

+1552
-60
lines changed

codechef/.in.swp

-12 KB
Binary file not shown.

codechef/Chef-jumping

33.1 KB
Binary file not shown.

codechef/Chef-jumping.cpp

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
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 lowbit(x) ((x)&((x)^((x)-1)))
23+
//#define max(a,b) (a<b?b:a)
24+
//#define abs(x) (x<0?-x:x)
25+
#define IN(i,l,r) (l<i&&i<r)
26+
#define LINR(i,l,r) (l<=i&&i<=r)
27+
#define LIN(i,l,r) (l<=i&&i<r)
28+
#define INR(i,l,r) (l<i&&i<r)
29+
#define F(i,L,R) for (int i = L; i < R; i++)
30+
#define FE(i,L,R) for (int i = L; i <= R; i++)
31+
#define FF(i,L,R) for (int i = L; i > R; i--)
32+
#define FFE(i,L,R) for (int i = L; i >= R; i--)
33+
#define char2Int(c) (c-'0')
34+
#define lastEle(vec) vec[vec.size()-1]
35+
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n))
36+
#define clr(a,x) memset(a,x,sizeof(a))
37+
#define getI(a) scanf("%d", &a)
38+
#define getII(a,b) scanf("%d%d", &a, &b)
39+
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
40+
#define getS(x) scanf("%s", x);
41+
#define SZ(x) ((int)((x).size()))
42+
#define REMAX(a,b) (a)=max((a),(b));
43+
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
44+
#define REMIN(a,b) (a)=min((a),(b));
45+
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
46+
#define ALL(t) t.begin(),t.end()
47+
#define ll long long
48+
#define ull unsigned long long
49+
#define ui unsigned int
50+
#define us unsigned short
51+
#define IOS ios_base::sync_with_stdio(0);
52+
#define pb push_back
53+
#define INF 1001001001
54+
#define PI 3.1415926535897932384626
55+
#define mp make_pair
56+
#define ll long long
57+
#define fi first
58+
#define se second
59+
#define wez(n) int (n); scanf("%d",&(n));
60+
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m));
61+
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k));
62+
inline void pisz(int n) { printf("%d\n",n); }
63+
#define TESTS wez(testow)while(testow--)
64+
#define whileZ int T; getI(T); while(T--)
65+
#define printA(a,L,R) FE(i,L,R) cout << a[i] << (i==R?'\n':' ')
66+
#define printM(a,n,m) F(i,0,n){ F(j,0,m) cout << a[i][j] << ' '; cout << endl;}
67+
#define printV(a) printA(a,0,a.size()-1);
68+
#define printVV(a) F(i,0,a.size()) {F(j,0,a[i].size())cout << a[i][j] << ' '; cout << endl;}
69+
#define MAXN 10000
70+
#define sz(a) int((a).size())
71+
#define pb push_back
72+
#define all(c) (c).begin(),(c).end()
73+
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
74+
#define present(c,x) ((c).find(x) != (c).end())
75+
#define cpresent(c,x) (find(all(c),x) != (c).end())
76+
typedef int elem_t;
77+
typedef vector<int> vi;
78+
typedef vector<vi> vvi;
79+
typedef pair<int,int> ii;
80+
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
81+
template<typename T> ostream& operator<<(ostream &s,vector<T> t){F(i,0,SZ(t))s<<t[i]<<" ";return s; }
82+
int gcd(int a,int b){return a?gcd(b%a,a):b;}
83+
ll gcd(ll a,ll b){return a?gcd(b%a,a):b;}
84+
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;}
85+
const int fx[4][2] = {{0,1}, {1,0}, {0,-1}, {-1,0}};
86+
int main ( int argc, char *argv[] ) {
87+
/*{
88+
FILE* file = fopen(argv[1], "r");
89+
int a, b;
90+
while(fscanf(file, "%d,%d", &a, &b) != EOF){
91+
}*/
92+
/*
93+
getI(T);
94+
int T;
95+
FE(cases,1,T){
96+
printf("Cases #%d: ", cases);
97+
}
98+
}*/
99+
/*
100+
Solution s = Solution();
101+
*/
102+
ll n;
103+
cin >> n;
104+
if (n % 6 == 0 || n % 6 == 1 || n % 6 == 3){
105+
cout << "yes" << endl;
106+
}else cout << "no" << endl;
107+
return EXIT_SUCCESS;
108+
}

codechef/Chef-jumping.o

44 KB
Binary file not shown.

codechef/Compilers-and-parsers

33.7 KB
Binary file not shown.

codechef/Compilers-and-parsers.cpp

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
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 lowbit(x) ((x)&((x)^((x)-1)))
23+
//#define max(a,b) (a<b?b:a)
24+
//#define abs(x) (x<0?-x:x)
25+
#define IN(i,l,r) (l<i&&i<r)
26+
#define LINR(i,l,r) (l<=i&&i<=r)
27+
#define LIN(i,l,r) (l<=i&&i<r)
28+
#define INR(i,l,r) (l<i&&i<r)
29+
#define F(i,L,R) for (int i = L; i < R; i++)
30+
#define FE(i,L,R) for (int i = L; i <= R; i++)
31+
#define FF(i,L,R) for (int i = L; i > R; i--)
32+
#define FFE(i,L,R) for (int i = L; i >= R; i--)
33+
#define char2Int(c) (c-'0')
34+
#define lastEle(vec) vec[vec.size()-1]
35+
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n))
36+
#define clr(a,x) memset(a,x,sizeof(a))
37+
#define getI(a) scanf("%d", &a)
38+
#define getII(a,b) scanf("%d%d", &a, &b)
39+
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
40+
#define getS(x) scanf("%s", x);
41+
#define SZ(x) ((int)((x).size()))
42+
#define REMAX(a,b) (a)=max((a),(b));
43+
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
44+
#define REMIN(a,b) (a)=min((a),(b));
45+
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
46+
#define ALL(t) t.begin(),t.end()
47+
#define ll long long
48+
#define ull unsigned long long
49+
#define ui unsigned int
50+
#define us unsigned short
51+
#define IOS ios_base::sync_with_stdio(0);
52+
#define pb push_back
53+
#define INF 1001001001
54+
#define PI 3.1415926535897932384626
55+
#define mp make_pair
56+
#define ll long long
57+
#define fi first
58+
#define se second
59+
#define wez(n) int (n); scanf("%d",&(n));
60+
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m));
61+
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k));
62+
inline void pisz(int n) { printf("%d\n",n); }
63+
#define TESTS wez(testow)while(testow--)
64+
#define whileZ int T; getI(T); while(T--)
65+
#define printA(a,L,R) FE(i,L,R) cout << a[i] << (i==R?'\n':' ')
66+
#define printM(a,n,m) F(i,0,n){ F(j,0,m) cout << a[i][j] << ' '; cout << endl;}
67+
#define printV(a) printA(a,0,a.size()-1);
68+
#define printVV(a) F(i,0,a.size()) {F(j,0,a[i].size())cout << a[i][j] << ' '; cout << endl;}
69+
#define MAXN 10000
70+
#define sz(a) int((a).size())
71+
#define pb push_back
72+
#define all(c) (c).begin(),(c).end()
73+
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
74+
#define present(c,x) ((c).find(x) != (c).end())
75+
#define cpresent(c,x) (find(all(c),x) != (c).end())
76+
typedef int elem_t;
77+
typedef vector<int> vi;
78+
typedef vector<vi> vvi;
79+
typedef pair<int,int> ii;
80+
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
81+
template<typename T> ostream& operator<<(ostream &s,vector<T> t){F(i,0,SZ(t))s<<t[i]<<" ";return s; }
82+
int gcd(int a,int b){return a?gcd(b%a,a):b;}
83+
ll gcd(ll a,ll b){return a?gcd(b%a,a):b;}
84+
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;}
85+
const int fx[4][2] = {{0,1}, {1,0}, {0,-1}, {-1,0}};
86+
char s[(int)1e6+10];
87+
int main ( int argc, char *argv[] ) {
88+
/*{
89+
FILE* file = fopen(argv[1], "r");
90+
int a, b;
91+
while(fscanf(file, "%d,%d", &a, &b) != EOF){
92+
}*/
93+
/*
94+
getI(T);
95+
int T;
96+
FE(cases,1,T){
97+
printf("Cases #%d: ", cases);
98+
}
99+
}*/
100+
/*
101+
Solution s = Solution();
102+
*/
103+
whileZ{
104+
getS(s);
105+
int st = 0;
106+
int i;
107+
int LValid = 0;
108+
for (i = 0; s[i] != 0; i++){
109+
if (s[i] == '<') st++;
110+
else{
111+
if (st == 0) break;
112+
else st--;
113+
if (st == 0) LValid = max(LValid, i+1);
114+
}
115+
}
116+
cout << LValid << endl;
117+
}
118+
return EXIT_SUCCESS;
119+
}

codechef/Compilers-and-parsers.o

45.3 KB
Binary file not shown.

codechef/Stone

37.7 KB
Binary file not shown.

codechef/Stone.cpp

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
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 lowbit(x) ((x)&((x)^((x)-1)))
23+
//#define max(a,b) (a<b?b:a)
24+
//#define abs(x) (x<0?-x:x)
25+
#define IN(i,l,r) (l<i&&i<r)
26+
#define LINR(i,l,r) (l<=i&&i<=r)
27+
#define LIN(i,l,r) (l<=i&&i<r)
28+
#define INR(i,l,r) (l<i&&i<r)
29+
#define F(i,L,R) for (int i = L; i < R; i++)
30+
#define FE(i,L,R) for (int i = L; i <= R; i++)
31+
#define FF(i,L,R) for (int i = L; i > R; i--)
32+
#define FFE(i,L,R) for (int i = L; i >= R; i--)
33+
#define char2Int(c) (c-'0')
34+
#define lastEle(vec) vec[vec.size()-1]
35+
#define hBit(msb,n) asm("bsrl %1,%0" : "=r"(msb) : "r"(n))
36+
#define clr(a,x) memset(a,x,sizeof(a))
37+
#define getI(a) scanf("%d", &a)
38+
#define getII(a,b) scanf("%d%d", &a, &b)
39+
#define getIII(a,b,c) scanf("%d%d%d", &a, &b, &c)
40+
#define getS(x) scanf("%s", x);
41+
#define SZ(x) ((int)((x).size()))
42+
#define REMAX(a,b) (a)=max((a),(b));
43+
#define DBG(vari) cerr<<#vari<<" = "<<(vari)<<endl;
44+
#define REMIN(a,b) (a)=min((a),(b));
45+
#define FOREACH(i,t) for (typeof(t.begin()) i=t.begin(); i!=t.end(); i++)
46+
#define ALL(t) t.begin(),t.end()
47+
#define ll long long
48+
#define ull unsigned long long
49+
#define ui unsigned int
50+
#define us unsigned short
51+
#define IOS ios_base::sync_with_stdio(0);
52+
#define pb push_back
53+
#define INF 1001001001
54+
#define PI 3.1415926535897932384626
55+
#define mp make_pair
56+
#define ll long long
57+
#define fi first
58+
#define se second
59+
#define wez(n) int (n); scanf("%d",&(n));
60+
#define wez2(n,m) int (n),(m); scanf("%d %d",&(n),&(m));
61+
#define wez3(n,m,k) int (n),(m),(k); scanf("%d %d %d",&(n),&(m),&(k));
62+
inline void pisz(int n) { printf("%d\n",n); }
63+
#define TESTS wez(testow)while(testow--)
64+
#define whileZ int T; getI(T); while(T--)
65+
#define printA(a,L,R) FE(i,L,R) cout << a[i] << (i==R?'\n':' ')
66+
#define printM(a,n,m) F(i,0,n){ F(j,0,m) cout << a[i][j] << ' '; cout << endl;}
67+
#define printV(a) printA(a,0,a.size()-1);
68+
#define printVV(a) F(i,0,a.size()) {F(j,0,a[i].size())cout << a[i][j] << ' '; cout << endl;}
69+
#define MAXN 10000
70+
#define sz(a) int((a).size())
71+
#define pb push_back
72+
#define all(c) (c).begin(),(c).end()
73+
#define tr(c,i) for(typeof((c).begin() i = (c).begin(); i != (c).end(); i++)
74+
#define present(c,x) ((c).find(x) != (c).end())
75+
#define cpresent(c,x) (find(all(c),x) != (c).end())
76+
typedef int elem_t;
77+
typedef vector<int> vi;
78+
typedef vector<vi> vvi;
79+
typedef pair<int,int> ii;
80+
template<typename T,typename TT> ostream& operator<<(ostream &s,pair<T,TT> t) {return s<<"("<<t.first<<","<<t.second<<")";}
81+
template<typename T> ostream& operator<<(ostream &s,vector<T> t){F(i,0,SZ(t))s<<t[i]<<" ";return s; }
82+
int gcd(int a,int b){return a?gcd(b%a,a):b;}
83+
ll gcd(ll a,ll b){return a?gcd(b%a,a):b;}
84+
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;}
85+
ll a[(int)1e5+1];
86+
int main ( int argc, char *argv[] ) {
87+
wez2(n,k);
88+
F(i,0,n) cin >> a[i];
89+
if (k == 0){
90+
printA(a, 0, n-1);
91+
}else{
92+
ll MIN = a[0], MAX = a[0];
93+
F(i,1,n){
94+
if (MIN > a[i]) MIN = a[i];
95+
if (MAX < a[i]) MAX = a[i];
96+
}
97+
if (k % 2 == 1){
98+
F(i,0,n){
99+
if (i != 0) cout << ' ';
100+
cout << MAX - a[i];
101+
}
102+
}else{
103+
F(i,0,n){
104+
if (i != 0) cout << ' ';
105+
cout << a[i] - MIN;
106+
}
107+
}
108+
cout << endl;
109+
}
110+
return EXIT_SUCCESS;
111+
}

codechef/Stone.o

45.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)