diff --git a/1846B Rudolph and Tic-Tac-Toe/1846B.cpp b/1846B Rudolph and Tic-Tac-Toe/1846B.cpp new file mode 100644 index 0000000..a050ebf --- /dev/null +++ b/1846B Rudolph and Tic-Tac-Toe/1846B.cpp @@ -0,0 +1,56 @@ +#include +using namespace std; +using ll = long long; + + +void solve() +{ + string s1,s2,s3; + cin>>s1>>s2>>s3; + + if(s1=="XXX") cout<<"X"<> TC; + cin.ignore(); + while (TC--) solve(); +} \ No newline at end of file diff --git a/1846C Rudolf and the Another Competition/1846C.cpp b/1846C Rudolf and the Another Competition/1846C.cpp new file mode 100644 index 0000000..98cad1a --- /dev/null +++ b/1846C Rudolf and the Another Competition/1846C.cpp @@ -0,0 +1,61 @@ +#include +using namespace std; +using ll = long long; + +void solve() +{ + ll n,m,h; + cin>>n>>m>>h; + vectorsolved; + vectorpenalty; + ll rs, rp; + for(ll i=0; ia; + for(ll j=0; j>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; irs) pos++; + else if(solved[i]==rs) + { + if(penalty[i]> TC; + cin.ignore(); + while (TC--) solve(); +} \ No newline at end of file diff --git a/1850B Ten Words of Wisdom/1850B.cpp b/1850B Ten Words of Wisdom/1850B.cpp new file mode 100644 index 0000000..3394480 --- /dev/null +++ b/1850B Ten Words of Wisdom/1850B.cpp @@ -0,0 +1,34 @@ +#include +using namespace std; +using ll = long long; + + +void solve() +{ + int n; + cin>>n; + mapans; + 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<second<> TC; + cin.ignore(); + while (TC--) solve(); +} \ No newline at end of file