Skip to content

Commit 4a54b37

Browse files
author
Jie Feng
committed
haha
2 parents d3596b2 + f5f26e6 commit 4a54b37

39 files changed

+1136
-0
lines changed

codeforces/.412A.cpp.swp

24 KB
Binary file not shown.

codeforces/.412B.cpp.swp

12 KB
Binary file not shown.

codeforces/.412C.cpp.swp

20 KB
Binary file not shown.

codeforces/.412D.cpp.swp

20 KB
Binary file not shown.

codeforces/.makefile.swp

12 KB
Binary file not shown.

codeforces/412A

32.1 KB
Binary file not shown.

codeforces/412A.cpp

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

codeforces/412A.o

44.6 KB
Binary file not shown.

codeforces/412B

45.6 KB
Binary file not shown.

codeforces/412B.cpp

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

0 commit comments

Comments
 (0)