diff --git a/Codes/1971 A - My First Sorting Problem/1971A.cpp b/Codes/1971 A - My First Sorting Problem/1971A.cpp new file mode 100644 index 0000000..c113d3a --- /dev/null +++ b/Codes/1971 A - My First Sorting Problem/1971A.cpp @@ -0,0 +1,24 @@ +#include +using namespace std; +#define ll long long +#define endl '\n' +ll pow(ll x,ll y,ll m=1e9+7){ll ans=1;x%=m;while(y){if(y&1)ans=(ans*x)%m;x=(x*x)%m;y>>=1;}return ans;} + +void solve() +{ + ll x,y; + cin>>x>>y; + cout<> TCS; + for (int TC = 1; TC <= TCS; ++TC) + { + // cout<<"Case "< +using namespace std; +#define ll long long +#define endl '\n' +ll pow(ll x,ll y,ll m=1e9+7){ll ans=1;x%=m;while(y){if(y&1)ans=(ans*x)%m;x=(x*x)%m;y>>=1;}return ans;} + +void solve() +{ + string s; + cin>>s; + bool ok=0; + for(int i=1; i> TCS; + for (int TC = 1; TC <= TCS; ++TC) + { + // cout<<"Case "< +using namespace std; +#define ll long long +#define endl '\n' +ll pow(ll x,ll y,ll m=1e9+7){ll ans=1;x%=m;while(y){if(y&1)ans=(ans*x)%m;x=(x*x)%m;y>>=1;}return ans;} + +void solve() +{ + ll a,b,c,d; + cin>>a>>b>>c>>d; + int ct=0; + for(int i=min(a,b); i<=max(a,b); ++i) + { + if(i==c || i==d) ct++; + } + if(ct & 1) cout<<"YES\n"; + else cout<<"NO\n"; +} + +signed main() +{ + ios_base::sync_with_stdio(false), cin.tie(nullptr); + int TCS = 1; + cin >> TCS; + for (int TC = 1; TC <= TCS; ++TC) + { + // cout<<"Case "< +using namespace std; +#define ll long long +#define endl '\n' +ll pow(ll x,ll y,ll m=1e9+7){ll ans=1;x%=m;while(y){if(y&1)ans=(ans*x)%m;x=(x*x)%m;y>>=1;}return ans;} + +void solve() +{ + string s; + cin>>s; + ll ans=1, f=0; + for(int i=1; i> TCS; + for (int TC = 1; TC <= TCS; ++TC) + { + // cout<<"Case "< +using namespace std; +#define ll long long +#define endl '\n' +ll pow(ll x,ll y,ll m=1e9+7){ll ans=1;x%=m;while(y){if(y&1)ans=(ans*x)%m;x=(x*x)%m;y>>=1;}return ans;} + +void solve() +{ + ll n,k,q; + cin>>n>>k>>q; + vectora(k+1),b(k+1); + a[0]=b[0]=0; + for(int i=1; i<=k; ++i) cin>>a[i]; + for(int i=1; i<=k; ++i) cin>>b[i]; + while(q--) + { + ll d; + cin>>d; + ll ind=lower_bound(a.begin(),a.end(),d) - a.begin(); + if(a[ind]==d) cout<> TCS; + for (int TC = 1; TC <= TCS; ++TC) + { + // cout<<"Case "< +using namespace std; +#define ll long long +#define endl '\n' +ll pow(ll x,ll y,ll m=1e9+7){ll ans=1;x%=m;while(y){if(y&1)ans=(ans*x)%m;x=(x*x)%m;y>>=1;}return ans;} + +ll points(ll r) +{ + ll p = 0; + for(ll x = 0; x <= r; ++x) + { + ll y,d = (r + 1) * (r + 1) - x * x; + ll l = 0, h = r; + while(l <= h) + { + ll mid = l + (h - l) / 2; + if(mid * mid < d) + { + y = mid; + l = mid + 1; + } + else h = mid - 1; + } + if(x == 0) p += (y * 2 + 1); + else p += ((y * 2 + 1) * 2); + } + return p; +} + +void solve() +{ + ll r; + cin >> r; + ll p1 = points(r); + ll p2 = points(r - 1); + cout << p1 - p2 << endl; +} + +signed main() +{ + ios_base::sync_with_stdio(false), cin.tie(nullptr); + int TCS = 1; + cin >> TCS; + for (int TC = 1; TC <= TCS; ++TC) + { + // cout<<"Case "<