Skip to content

Commit cb78210

Browse files
committed
adding new
1 parent 9113cc3 commit cb78210

File tree

7 files changed

+34
-46
lines changed

7 files changed

+34
-46
lines changed

CP_COURSE/DAY1/Day1-CF.odp

1 MB
Binary file not shown.

CP_COURSE/DAY1/Day1-breif.odp

3.41 MB
Binary file not shown.

Template/Main

-10.9 KB
Binary file not shown.

Template/Main.cpp

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,55 +15,52 @@ typedef long long int ll;
1515
typedef double dl;
1616
typedef unsigned long long int ull;
1717

18-
//Funtions
19-
template <class T> T digitsum(T n) {T sum = 0; while (n != 0) {sum += n % 10; n /= 10;} return sum;}
20-
template <class T> T gcd(T a, T b) { T x ; return x = __gcd(a, b);}
21-
template <class T> T lcm(T a, T b) {T y; return y = ((a) * (b)) / gcd(a, b);}
22-
23-
// Debugger
24-
#define gobug 0
25-
#define debugNS(a,b,c) cout<<a<<b<<c<<endl;
26-
#define debugN(b) cout<<b<<endl;
27-
28-
int ROW[] = { +0, +0, -1, +1};
29-
int COL[] = { +1, -1, +0, +0};
30-
31-
int X[] = { +0, +0, +1, -1, -1, +1, -1, +1}; // Kings Move
32-
int Y[] = { -1, +1, +0, +0, +1, +1, -1, -1}; // Kings Move
33-
34-
int KX[] = { -2, -2, -1, -1, 1, 1, 2, 2}; // Knights Move
35-
int KY[] = { -1, 1, -2, 2, -2, 2, -1, 1}; // Knights Move
3618

19+
void solve() {
20+
int n; cin>>n;
21+
vector<int>v(n), frek(n+1);
3722

3823

24+
for(int i=0; i<n; i++){
25+
cin>>v[i];
26+
while(v[i]>n)
27+
v[i]=v[i]/2;
28+
frek[v[i]]++;
29+
}
30+
bool flg = false;
3931

40-
void solve() {
41-
int n; cin>>n;
42-
map<string, int>mp;
43-
while(n--){
44-
string s; cin>>s;
45-
mp[s]++;
46-
if(mp[s]>1)cout<<s<<(int)mp[s]-1<<endl;
47-
else cout<<"OK"<<endl;
32+
for(int i=n; i>0; i--){
33+
if(frek[i]==0){
34+
flg = true;
35+
break;
36+
}
37+
frek[i/2]+=frek[i]-1;
4838
}
4939

40+
// for(int i=1; i<n+1; i++)cout<<frek[i]<<" ";
41+
// cout<<endl;
42+
// for(int i=0; i<n; i++)cout<<v[i]<<" ";
43+
// cout<<endl;
44+
if(!flg)cout<<"YES"<<endl;
45+
else cout<<"NO"<<endl;
5046
}
5147

5248
int main() {
5349

54-
#ifdef anikakash
50+
#ifdef wordsworth
5551
clock_t tStart = clock();
5652
freopen("input.txt", "r", stdin);
5753
freopen("ans.txt", "w", stdout);
5854
#endif
5955

6056
FASTERIO;
6157

62-
// int tt; cin >> tt;
63-
// while (tt--) {
58+
int tt; cin >> tt;
59+
while (tt--) {
6460
solve();
65-
// }
66-
#ifdef anikakash
61+
}
62+
63+
#ifdef wordsworth
6764
fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
6865
#endif
6966
return 0;

Template/ans.txt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1 @@
1-
OK
2-
first1
3-
OK
4-
second1
5-
OK
6-
third1
1+
YES

Template/input.txt

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

Template/test.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ int KY[] = { -1, 1, -2, 2, -2, 2, -1, 1}; // Knights Move
3838

3939
int main() {
4040

41-
#ifdef anikakash
41+
#ifdef wordsworth
4242
clock_t tStart = clock();
4343
freopen("input.txt", "r", stdin);
4444
freopen("ans.txt", "w", stdout);
@@ -65,7 +65,7 @@ int main() {
6565

6666
}
6767

68-
#ifdef anikakash
68+
#ifdef wordsworth
6969
fprintf(stderr, "\n>> Runtime: %.10fs\n", (double) (clock() - tStart) / CLOCKS_PER_SEC);
7070
#endif
7171
return 0;

0 commit comments

Comments
 (0)