Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b07b859

Browse files
addds 5 800 ratyed
1 parent b8dd744 commit b07b859

File tree

5 files changed

+566
-0
lines changed

5 files changed

+566
-0
lines changed
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
// Type definitions
5+
typedef long long ll;
6+
typedef pair<int, int> pii;
7+
typedef pair<ll, ll> pll;
8+
typedef vector<int> vi;
9+
typedef vector<ll> vl;
10+
typedef vector<pii> vpii;
11+
typedef vector<pll> vpll;
12+
typedef vector<vi> vvi;
13+
typedef vector<vl> vvl;
14+
15+
// Macros
16+
#define nline "\n"
17+
#define all(x) (x).begin(), (x).end()
18+
#define rall(x) (x).rbegin(), (x).rend()
19+
#define sz(x) (int)(x).size()
20+
#define pb push_back
21+
#define mp make_pair
22+
#define F first
23+
#define S second
24+
#define forn(i, n) for (int i = 0; i < int(n); i++)
25+
#define forr(i, a, b) for (int i = a; i <= b; i++)
26+
#define ford(i, a, b) for (int i = a; i >= b; i--)
27+
#define elasped_time 1.0 * clock() / CLOCKS_PER_SEC
28+
29+
// Constants
30+
const int MOD = 1e9 + 7;
31+
const ll INF = 1e18;
32+
const double EPS = 1e-9;
33+
const double PI = acos(-1);
34+
35+
ll mod_add(ll a, ll b, ll m = MOD) { return ((a % m) + (b % m)) % m; }
36+
ll mod_sub(ll a, ll b, ll m = MOD) { return ((a % m) - (b % m) + m) % m; }
37+
ll mod_mul(ll a, ll b, ll m = MOD) { return ((a % m) * (b % m)) % m; }
38+
39+
ll mod_pow(ll base, ll exp, ll m = MOD)
40+
{
41+
ll res = 1;
42+
base %= m;
43+
while (exp > 0)
44+
{
45+
if (exp & 1)
46+
res = mod_mul(res, base, m);
47+
base = mod_mul(base, base, m);
48+
exp >>= 1;
49+
}
50+
return res;
51+
}
52+
53+
ll mod_inv(ll a, ll m = MOD)
54+
{
55+
return mod_pow(a, m - 2, m); // Only works if m is prime
56+
}
57+
58+
ll mod_div(ll a, ll b, ll m = MOD)
59+
{
60+
return mod_mul(a, mod_inv(b, m), m);
61+
}
62+
63+
// Binary exponentiation (for non-modular calculations)
64+
ll binpow(ll base, ll exp)
65+
{
66+
ll res = 1;
67+
while (exp > 0)
68+
{
69+
if (exp & 1)
70+
res *= base;
71+
base *= base;
72+
exp >>= 1;
73+
}
74+
return res;
75+
}
76+
77+
/************/
78+
79+
void solve()
80+
{
81+
int n, k;
82+
cin >> n >> k;
83+
84+
forn(i, n) cout << (i < k);
85+
86+
cout << nline;
87+
}
88+
int main()
89+
{
90+
ios_base::sync_with_stdio(0);
91+
cin.tie(0);
92+
cout.tie(0);
93+
94+
#ifndef ONLINE_JUDGE
95+
freopen("./outputs/input.txt", "r", stdin);
96+
freopen("./outputs/output.txt", "w", stdout);
97+
#endif
98+
99+
int t;
100+
cin >> t;
101+
while (t--)
102+
solve();
103+
104+
return 0;
105+
}
106+
// Explanation
107+
/*
108+
*/
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
// Type definitions
5+
typedef long long ll;
6+
typedef pair<int, int> pii;
7+
typedef pair<ll, ll> pll;
8+
typedef vector<int> vi;
9+
typedef vector<ll> vl;
10+
typedef vector<pii> vpii;
11+
typedef vector<pll> vpll;
12+
typedef vector<vi> vvi;
13+
typedef vector<vl> vvl;
14+
15+
// Macros
16+
#define nline "\n"
17+
#define all(x) (x).begin(), (x).end()
18+
#define rall(x) (x).rbegin(), (x).rend()
19+
#define sz(x) (int)(x).size()
20+
#define pb push_back
21+
#define mp make_pair
22+
#define F first
23+
#define S second
24+
#define forn(i, n) for (int i = 0; i < int(n); i++)
25+
#define forr(i, a, b) for (int i = a; i <= b; i++)
26+
#define ford(i, a, b) for (int i = a; i >= b; i--)
27+
#define elasped_time 1.0 * clock() / CLOCKS_PER_SEC
28+
29+
// Constants
30+
const int MOD = 1e9 + 7;
31+
const ll INF = 1e18;
32+
const double EPS = 1e-9;
33+
const double PI = acos(-1);
34+
35+
ll mod_add(ll a, ll b, ll m = MOD) { return ((a % m) + (b % m)) % m; }
36+
ll mod_sub(ll a, ll b, ll m = MOD) { return ((a % m) - (b % m) + m) % m; }
37+
ll mod_mul(ll a, ll b, ll m = MOD) { return ((a % m) * (b % m)) % m; }
38+
39+
ll mod_pow(ll base, ll exp, ll m = MOD)
40+
{
41+
ll res = 1;
42+
base %= m;
43+
while (exp > 0)
44+
{
45+
if (exp & 1)
46+
res = mod_mul(res, base, m);
47+
base = mod_mul(base, base, m);
48+
exp >>= 1;
49+
}
50+
return res;
51+
}
52+
53+
ll mod_inv(ll a, ll m = MOD)
54+
{
55+
return mod_pow(a, m - 2, m); // Only works if m is prime
56+
}
57+
58+
ll mod_div(ll a, ll b, ll m = MOD)
59+
{
60+
return mod_mul(a, mod_inv(b, m), m);
61+
}
62+
63+
// Binary exponentiation (for non-modular calculations)
64+
ll binpow(ll base, ll exp)
65+
{
66+
ll res = 1;
67+
while (exp > 0)
68+
{
69+
if (exp & 1)
70+
res *= base;
71+
base *= base;
72+
exp >>= 1;
73+
}
74+
return res;
75+
}
76+
77+
/************/
78+
79+
void solve()
80+
{
81+
int n;
82+
cin >> n;
83+
84+
cout << 1 << " ";
85+
86+
ford(i, n, 2) cout << i << " ";
87+
88+
cout << nline;
89+
}
90+
int main()
91+
{
92+
ios_base::sync_with_stdio(0);
93+
cin.tie(0);
94+
cout.tie(0);
95+
96+
#ifndef ONLINE_JUDGE
97+
freopen("./outputs/input.txt", "r", stdin);
98+
freopen("./outputs/output.txt", "w", stdout);
99+
#endif
100+
101+
int t;
102+
cin >> t;
103+
while (t--)
104+
solve();
105+
106+
return 0;
107+
}
108+
// Explanation
109+
/*
110+
*/
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
// Type definitions
5+
typedef long long ll;
6+
typedef pair<int, int> pii;
7+
typedef pair<ll, ll> pll;
8+
typedef vector<int> vi;
9+
typedef vector<ll> vl;
10+
typedef vector<pii> vpii;
11+
typedef vector<pll> vpll;
12+
typedef vector<vi> vvi;
13+
typedef vector<vl> vvl;
14+
15+
// Macros
16+
#define nline "\n"
17+
#define all(x) (x).begin(), (x).end()
18+
#define rall(x) (x).rbegin(), (x).rend()
19+
#define sz(x) (int)(x).size()
20+
#define pb push_back
21+
#define mp make_pair
22+
#define F first
23+
#define S second
24+
#define forn(i, n) for (int i = 0; i < int(n); i++)
25+
#define forr(i, a, b) for (int i = a; i <= b; i++)
26+
#define ford(i, a, b) for (int i = a; i >= b; i--)
27+
#define elasped_time 1.0 * clock() / CLOCKS_PER_SEC
28+
29+
// Constants
30+
const int MOD = 1e9 + 7;
31+
const ll INF = 1e18;
32+
const double EPS = 1e-9;
33+
const double PI = acos(-1);
34+
35+
ll mod_add(ll a, ll b, ll m = MOD) { return ((a % m) + (b % m)) % m; }
36+
ll mod_sub(ll a, ll b, ll m = MOD) { return ((a % m) - (b % m) + m) % m; }
37+
ll mod_mul(ll a, ll b, ll m = MOD) { return ((a % m) * (b % m)) % m; }
38+
39+
ll mod_pow(ll base, ll exp, ll m = MOD)
40+
{
41+
ll res = 1;
42+
base %= m;
43+
while (exp > 0)
44+
{
45+
if (exp & 1)
46+
res = mod_mul(res, base, m);
47+
base = mod_mul(base, base, m);
48+
exp >>= 1;
49+
}
50+
return res;
51+
}
52+
53+
ll mod_inv(ll a, ll m = MOD)
54+
{
55+
return mod_pow(a, m - 2, m); // Only works if m is prime
56+
}
57+
58+
ll mod_div(ll a, ll b, ll m = MOD)
59+
{
60+
return mod_mul(a, mod_inv(b, m), m);
61+
}
62+
63+
// Binary exponentiation (for non-modular calculations)
64+
ll binpow(ll base, ll exp)
65+
{
66+
ll res = 1;
67+
while (exp > 0)
68+
{
69+
if (exp & 1)
70+
res *= base;
71+
base *= base;
72+
exp >>= 1;
73+
}
74+
return res;
75+
}
76+
77+
/************/
78+
79+
void solve()
80+
{
81+
int n, k;
82+
cin >> n >> k;
83+
84+
vi arr(n, 0);
85+
86+
int first = -1;
87+
int last = -1;
88+
89+
forn(i, n)
90+
{
91+
cin >> arr[i];
92+
if (first == -1 && arr[i])
93+
first = i;
94+
95+
if (arr[i])
96+
last = i;
97+
}
98+
99+
cout << (first + k - 1 < last ? "NO" : "YES") << nline;
100+
}
101+
int main()
102+
{
103+
ios_base::sync_with_stdio(0);
104+
cin.tie(0);
105+
cout.tie(0);
106+
107+
#ifndef ONLINE_JUDGE
108+
freopen("./outputs/input.txt", "r", stdin);
109+
freopen("./outputs/output.txt", "w", stdout);
110+
#endif
111+
112+
int t;
113+
cin >> t;
114+
while (t--)
115+
solve();
116+
117+
return 0;
118+
}
119+
// Explanation
120+
/*
121+
*/

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /