initial commit

This commit is contained in:
ShazidMahsrafi 2023-08-03 02:42:39 +06:00
parent 0292766232
commit c556caa6ff
3 changed files with 151 additions and 0 deletions

View File

@ -0,0 +1,56 @@
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
void solve()
{
string s1,s2,s3;
cin>>s1>>s2>>s3;
if(s1=="XXX") cout<<"X"<<endl;
else if (s1=="OOO") cout<<"O"<<endl;
else if(s1=="+++") cout<<"+"<<endl;
else if(s2=="XXX") cout<<"X"<<endl;
else if (s2=="OOO") cout<<"O"<<endl;
else if(s2=="+++") cout<<"+"<<endl;
else if(s3=="XXX") cout<<"X"<<endl;
else if (s3=="OOO") cout<<"O"<<endl;
else if(s3=="+++") cout<<"+"<<endl;
else if(s1[0]=='X' && s2[0]=='X' && s3[0]=='X') cout<<"X"<<endl;
else if(s1[0]=='O' && s2[0]=='O' && s3[0]=='O') cout<<"O"<<endl;
else if(s1[0]=='+' && s2[0]=='+' && s3[0]=='+') cout<<"+"<<endl;
else if(s1[1]=='X' && s2[1]=='X' && s3[1]=='X') cout<<"X"<<endl;
else if(s1[1]=='O' && s2[1]=='O' && s3[1]=='O') cout<<"O"<<endl;
else if(s1[1]=='+' && s2[1]=='+' && s3[1]=='+') cout<<"+"<<endl;
else if(s1[2]=='X' && s2[2]=='X' && s3[2]=='X') cout<<"X"<<endl;
else if(s1[2]=='O' && s2[2]=='O' && s3[2]=='O') cout<<"O"<<endl;
else if(s1[2]=='+' && s2[2]=='+' && s3[2]=='+') cout<<"+"<<endl;
else if(s1[0]=='X' && s2[1]=='X' && s3[2]=='X') cout<<"X"<<endl;
else if(s1[0]=='O' && s2[1]=='O' && s3[2]=='O') cout<<"O"<<endl;
else if(s1[0]=='+' && s2[1]=='+' && s3[2]=='+') cout<<"+"<<endl;
else if(s1[2]=='X' && s2[1]=='X' && s3[0]=='X') cout<<"X"<<endl;
else if(s1[2]=='O' && s2[1]=='O' && s3[0]=='O') cout<<"O"<<endl;
else if(s1[2]=='+' && s2[1]=='+' && s3[0]=='+') cout<<"+"<<endl;
else cout<<"DRAW"<<endl;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int TC = 1;
cin >> TC;
cin.ignore();
while (TC--) solve();
}

View File

@ -0,0 +1,61 @@
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
void solve()
{
ll n,m,h;
cin>>n>>m>>h;
vector<ll>solved;
vector<ll>penalty;
ll rs, rp;
for(ll i=0; i<n; ++i)
{
vector<ll>a;
for(ll j=0; j<m; ++j)
{
ll x;
cin>>x;
a.push_back(x);
}
sort(a.begin(),a.end());
ll time=0,pen=0,ct=0;
for(ll x:a)
{
time=time+x;
if(h>=time)
{
ct++;
pen=pen+time;
}
}
if(i==0)
{
rs=ct;
rp=pen;
}
solved.push_back(ct);
penalty.push_back(pen);
}
ll pos=1;
for(ll i=1; i<n; ++i)
{
if(solved[i]>rs) pos++;
else if(solved[i]==rs)
{
if(penalty[i]<rp) pos++;
}
}
cout<<pos<<endl;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
ll TC = 1;
cin >> TC;
cin.ignore();
while (TC--) solve();
}

View File

@ -0,0 +1,34 @@
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
void solve()
{
int n;
cin>>n;
map<int,int>ans;
int max=0;
for(int i=1; i<=n; ++i)
{
int x,y;
cin>>x>>y;
if(x<=10)
{
ans[y]=i;
}
}
auto it=ans.rbegin();
cout<<it->second<<endl;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
int TC = 1;
cin >> TC;
cin.ignore();
while (TC--) solve();
}