Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions round-75(educational)/2048_a.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include<bits/stdc++.h>
using namespace std;
int main(){
int t; cin >> t;
while(t--){
int n; cin >> n;
int arr[n], ssf = 0;
for(int i = 0; i < n ; i++){
cin >> arr[i];
if(arr[i] <= 2048)
ssf += arr[i];
}
if(ssf >= 2048){
cout << "YES" << endl;
}
else
cout << "NO" << endl;
}
}
35 changes: 35 additions & 0 deletions round-75(educational)/d.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include<bits/stdc++.h>
using namespace std;
#define lli long long int
int main(){
int t; cin >> t;
while(t--){
int n; cin >> n;
vector<pair<lli,lli>>v(n);

for(int i = 0; i < n; i++){
lli x, y;
// cin >> x >> y;
v[i].first = x;
v[i].second = y;
}


vector<vector<lli>> dp(n, vector<lli>(4, INT_MAX));
for(int i = 1; i < n; i++){
for(int j = 1; j <= 3; j++){
for(int k = 0; k <= 2; k++){
if(v[i-1].first+k != v[i].first+j)
dp[i][j] = min(dp[i][j], dp[i-1][k]);
}
dp[i][j] += j*v[i].second;
}
}
lli minv = 0;
for(int j = 1; j <= 3; j++){
minv = min(minv, dp[n-1][j]);
}
cout << minv << endl;
return 0;
}
}
15 changes: 15 additions & 0 deletions round-75(educational)/knights_b.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#include<bits/stdc++.h>
using namespace std;
int main(){
int n; cin >> n;
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
if(((i+j) % 2 )== 0){
cout << "W";
}else{
cout << "B";
}
}
cout << endl;
}
}
12 changes: 12 additions & 0 deletions round-75(educational)/perfect_team_c.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include<bits/stdc++.h>
using namespace std;
int main(){
int t; cin >> t;
while(t--){
int c, m,x;
cin >> c >> m >> x;
int avg = (c+m+x)/3;
int ans = min(min(c, m), avg);
cout << ans << endl;
}
}