Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ayushday15 #93

Merged
merged 2 commits into from
Apr 12, 2024
Merged
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
57 changes: 57 additions & 0 deletions Easy/Day 15/solution.cpp
Original file line number Diff line number Diff line change
@@ -1 +1,58 @@
// Write your code here.
#include<bits/stdc++.h>
using namespace std;

bool check_line(vector<vector<int> > &visited){
for (int i = 0; i < 3; ++i) {
if ((visited[i][0] && visited[i][1] && visited[i][2] ) ||
(visited[0][i] && visited[1][i] && visited[2][i] )) {
return true;
}
}

// Check diagonals
if ((visited[0][0] && visited[1][1] && visited[2][2] ) ||
(visited[0][2] && visited[1][1] && visited[2][0] )) {
return true;
}

return false;
}

int main(){
vector<vector<int> > store;
for(int i=0;i<3;i++){
int a,b,c;
cin>>a>>b>>c;
vector<int> temp;
temp.push_back(a);
temp.push_back(b);
temp.push_back(c);
store.push_back(temp);
}

vector<vector<int> >visited(3,vector<int>(3,0));

int n;
cin>>n;
for(int i=0;i<n;i++){
int temp;
cin>>temp;

for(int i=0;i<3;i++){
for(int j=0;j<3;j++){
if(store[i][j]==temp){
visited[i][j]=1;
break;
}
}
}

if(check_line(visited)){
cout<<"YES";
exit(0);
}
}
cout<<"NO";
return 0;
}
17 changes: 16 additions & 1 deletion Easy/Day 18/solution.cpp
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
// Write your code here.
// Write your code here.
#include <bits/stdc++.h>
using namespace std;

int main(){
string s;
cin>>s;
if(s[5] == '0' && s[6] <= '4'){
cout<<"Yes"<<endl;
}
else {
cout<<"No"<<endl;
}

return 0;
}
Loading