Skip to content

Commit 6543f9b

Browse files
Michael  ChenMichael  Chen
authored andcommitted
New commit
1 parent 6d496c5 commit 6543f9b

Some content is hidden

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

99 files changed

+1448
-3
lines changed

.DS_Store

10 KB
Binary file not shown.

1089G/1089G.sublime-project

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"folders":
3+
[
4+
{
5+
"path": "/Users/chen.young/code/1089G"
6+
}
7+
]
8+
}

1089G/a.out

15.5 KB
Binary file not shown.

1089G/ans.cpp

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
typedef long long ll;
5+
typedef pair<int, int> pii;
6+
typedef vector<int> vi;
7+
8+
#define mp make_pair
9+
#define pb push_back
10+
11+
int main() {
12+
#if defined(SUBLIME_RUN) || defined(USE_INPUT_FILE)
13+
freopen("input.txt", "r", stdin);
14+
#endif
15+
ios::sync_with_stdio(0);
16+
int t; cin >> t;
17+
vi days(7);
18+
19+
while (t--) {
20+
// cout << t<< endl;
21+
int ans = INT_MAX;
22+
int k; cin >> k;
23+
int ones = 0;
24+
for (int i=0; i<7; ++i) {
25+
cin >> days[i];
26+
ones += days[i];
27+
}
28+
29+
int goal = k%ones;
30+
// cout << goal << endl;
31+
for (int start=0; start<7; ++start) {
32+
if (!days[start]) continue;
33+
34+
int cur = 1;
35+
int ind = start;
36+
while (cur != goal) {
37+
++ind;
38+
// cout << cur << endl;
39+
ind %= 7;
40+
if (days[ind]) {
41+
++cur;
42+
cur %= ones;
43+
}
44+
}
45+
int end = ind;
46+
// printf("%d %d\n", start, end);
47+
if (end < start) end += 7;
48+
ans = min(ans, 1+7*((k-1)/ones)+end-start);
49+
}
50+
cout << ans << endl;
51+
}
52+
}
53+

1089G/input.txt

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

1089G/zzz

15.6 KB
Binary file not shown.

1090M/1090M.sublime-project

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"folders":
3+
[
4+
{
5+
"path": "/Users/chen.young/code/1090M"
6+
}
7+
]
8+
}

1090M/a.out

15.5 KB
Binary file not shown.

1090M/ans.cpp

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
typedef long long ll;
5+
typedef pair<int, int> pii;
6+
typedef vector<int> vi;
7+
8+
#define mp make_pair
9+
#define pb push_back
10+
11+
int main() {
12+
#if defined(SUBLIME_RUN) || defined(USE_INPUT_FILE)
13+
freopen("input.txt", "r", stdin);
14+
#endif
15+
ios::sync_with_stdio(0);
16+
int n, k;
17+
cin >> n >> k;
18+
vi a(n);
19+
for (int i=0; i<n; ++i) cin >> a[i];
20+
21+
int ans = 1;
22+
int ind = 0;
23+
while (ind < n) {
24+
int start = ind;
25+
while (ind < n && a[ind] != a[ind+1]) {
26+
++ind;
27+
}
28+
// printf("%d %d\n", start, ind);
29+
ind = min(ind, n-1);
30+
ans = max(ans, ind-start+1);
31+
++ind;
32+
33+
}
34+
cout << ans << endl;
35+
}

1090M/input.txt

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

0 commit comments

Comments
 (0)