"Như là người tôi yêu thương nhất trên đời này. Cô ấy có một nụ cười dịu dàng và ánh mắt ấm áp, luôn khiến tôi cảm thấy bình yên mỗi khi nhìn vào. Như không chỉ đẹp về ngoại hình mà còn có một tâm hồn trong sáng, luôn quan tâm và chăm sóc những người xung quanh. Cô ấy khiến tôi cảm thấy mình là người may mắn nhất khi có thể chia sẻ những khoảnh khắc vui buồn cùng. Mỗi lần bên Như, tôi luôn cảm thấy như thời gian trôi qua thật nhanh, và tôi biết rằng tôi muốn bên cô ấy suốt cả cuộc đời này."
Bình luận
include<bits/stdc++.h>
define ll long long
define sc second
define fr first
define pb push_back
using namespace std;
ll l[1000006], r[1000006]; int main(){ iosbase::syncwithstdio(0); cin.tie(0); cout.tie(0); //freopen("waiting.inp", "r", stdin); //freopen("waiting.out", "w", stdout); ll n, m; cin >> n >> m; vector<pair> v;
for(int i = 0; i < n ; i++){
ll x, y; cin >> x >> y;
v.pb({x, y});
}
sort(v.begin(), v.end());
for(int i = 0; i < n; i++){
l[i] = v[i].fr;
}
r[0] = v[0].sc;
for(int i = 1; i < n; i++){
r[i] = max(r[i-1], v[i].sc);
}
for(int i = 1; i <= m; i++){
ll x; cin >> x;
auto it = upper bound(l + 1, l + n + 1,x) - l;
it--;
if(r[it] > x && it >= 0){
cout << 0 << "\n";
}
else{
if(it == n-1){
cout << -1 << "\n";
}
else{
cout << l[it] - x << "\n";
}
}
}
}
include<bits/stdc++.h>
define ll long long
define sc second
define fr first
define pb push_back
using namespace std;
ll l[1000006], r[1000006]; int main(){ iosbase::syncwithstdio(0); cin.tie(0); cout.tie(0); //freopen("waiting.inp", "r", stdin); //freopen("waiting.out", "w", stdout); ll n, m; cin >> n >> m; vector<pair> v;
for(int i = 0; i < n ; i++){
ll x, y; cin >> x >> y;
v.pb({x, y});
}
sort(v.begin(), v.end());
for(int i = 0; i < n; i++){
l[i] = v[i].fr;
}
for(int i = 0; i < n; i++){
r[i] = max(r[i-1], v[i].sc);
}
for(int i = 1; i <= m; i++){
ll x; cin >> x;
auto it = upper bound(l + 1, l + n + 1,x) - l;
it--;
if(l[it] <= x){
cout << 0 << "\n";
}
else{
if(it == n-1){
cout << -1 << "\n";
break;
}
else{
cout << l[it] - x << "\n";
}
}
}
}
include<bits/stdc++.h>
define ll long long
define fr first
define sc second
define pb push_back
define db double
using namespace std; bool check(string s){ for(auto x : s){ if(!isdigit(x)) return 0; } return 1; } bool c(string s, string t){ if(s.size() == t.size()){ for(int i = 0; i < s.size(); i++){ if(s[i] < t[i]) return 1; } return 0; } return s.size() < t.size(); } int main() { iosbase::syncwith_stdio(false); cin.tie(NULL); cout.tie(NULL); //freopen("bai2.INP", "r",stdin); //freopen("bai2.out", "w", stdout); ll n; cin >> n; vector<string> v; for(int i = 0 ; i <n ;i++){ string s; cin >> s; v.pb(s); } for(int i = 0; i < n; i++){ if(check(v[i])){ for(int j = 0; j < n; j++){ if(check(v[j])){ if(c(v[i], v[j])){ swap(v[i], v[j]); } } } } } for(auto x : v){ cout << x << " "; } }
include <bits/stdc++.h>
using namespace std;
define ll long long
define ld long double
define FOR(i,a,b) for(int i = a; i <= b; i++)
define FOD(i,b,a) for(int i = b; i >= a; i--)
define pii pair<int,int>
define X first
define Y second
define Name "SELESHIRT"
pii a[(int)1e5+5], b[(int)1e5+5];
int main(){ iosbase::syncwith_stdio(0); cin.tie(NULL); cout.tie(NULL);
}
/* */
n / 2 * n - (n / 2) * (n / 2 + 1)
include<bits/stdc++.h>
define ll long long
define fr first
define sc second
define pb push_back
define db double
using namespace std ;
ll a[1000006]; db f[1000006]; bool check(ll n,ll k, db mid){ for(int i = 0; i < n; i++){ f[i] = f[i-1] + a[i] - mid; } ll l = 0, r = 0; db m = 1e18; while(r <= n){ while(r -l +1>= k){ if(f[r] - m >= 0){ return 1; } m = min( m, f[l]); l++; } r++; } return 0; }
int main() { iosbase::syncwith_stdio(false); cin.tie(NULL); cout.tie(NULL); //freopen("AVERAGE.INP", "r",stdin); //freopen("AVERAGE.out", "w", stdout); ll n, k; cin >> n >> k; for(int i = 0 ; i < n ; i++){ cin >> a[i]; } ll l = -1e9, r = 1e9; db ans = 0; for(int i = 1; i <= 80; i++){ db mid = (l+r)/2; if(check(n, k, mid)){ ans = mid; l = mid; } else{ r = mid; } } cout << fixed << setprecision(3) << ans ; }
`#include<bits/stdc++.h>
define ll long long
define fr first
define sc second
define pb push_back
define db double
using namespace std ;
ll a[1000006]; db f[1000006]; bool check(ll n,ll k, db mid){ f[0] = a[0] - mid; for(int i = 1; i < n; i++){ f[i] = f[i-1] + a[i] - mid; } ll l = 0, r = 0; db m = 0; while(r <= n){ while(r -l + 1 >= k){ if(f[r] - m >= 0){ return 1; } m = min( m, f[l]); l++; } r++; } return 0; }
int main() { iosbase::syncwith_stdio(false); cin.tie(NULL); cout.tie(NULL); //freopen("AVERAGE.INP", "r",stdin); //freopen("AVERAGE.out", "w", stdout); ll n, k; cin >> n >> k; for(int i = 0 ; i < n ; i++){ cin >> a[i]; } ll l = -1e9, r = 1e9; db ans = 0; for(int i = 0; i < 80; i++){ db mid = (l+r)/2; if(check(n, k, mid)){ ans = mid; l = mid; } else{ r = mid; } } cout << fixed << setprecision(3) << ans ; } `
include <bits/stdc++.h>
using namespace std;
define ll long long
define ld long double
define FOR(i,a,b) for(int i = a; i <= b; i++)
define FOD(i,b,a) for(int i = b; i >= a; i--)
define pii pair<int,int>
define X first
define Y second
define Name ""
int n, k; int a[(int)2e5+5]; ld f[(int)2e5+5];
bool ok(ld x){ FOR(i,1,n)f[i]=f[i-1]+a[i]-x; ld mi = 0; int r = 1, l = 1; while(r<=n){ while(r-l+1>=k){ if(f[r]-mi>=0)return true; mi=min(mi, f[l++]); } r++; } return false; }
int main(){ iosbase::syncwith_stdio(0); cin.tie(NULL); cout.tie(NULL);
}
/* */
include<bits/stdc++.h>
define ll long long
define sc second
define fr first
define pb push_back
using namespace std;
bool check(string s){ if(isdigit(s[1])){ return 0; } if(isdigit(s[0])){ if(s[0] - '0' > 1) return 0; } return 1; } bool tinh(string s){ ll i = s.size() - 1; if(s[i] == 'x' || s[i] == 'y' || s[i] == 'z' ) return 1; else if(s[i]== 'h' && s[i-1] == 'c' ||s[i]== 'h' && s[i-1] == 's') return 1; return 0; } int main() { iosbase::syncwith_stdio(false); cin.tie(NULL); cout.tie(NULL); //freopen("danhtu.inp", "r",stdin); //freopen("danhtu.out", "w", stdout); string t; getline(cin, t); stringstream ss(t); string w; vector<string> v; while(ss >> w){ if(!check(w)){ v.pb(w); } } ll e = 0, s = 0, ans = 0; for(auto x : v){ if(tinh(x)){ e++; s++; } else{ s++; } } cout << e << " " << s; }
include<bits/stdc++.h>
define ll long long
define sc second
define fr first
define pb push_back
using namespace std;
bool check(ll a[], ll n, ll m, ll mid){ if(mid == 0) return 0; ll res = 0; for(int i = 0 ; i < n ; i++){ res += a[i]/mid; if(res >= m) return 1; } return 0; } ll a[100005]; int main() { iosbase::syncwithstdio(false); cin.tie(NULL); cout.tie(NULL); //freopen("good.inp", "r",stdin); //freopen("good.out", "w", stdout); ll n, m; cin >> n >> m; for(int i = 0 ; i < n ; i++){ cin >> a[i]; } ll l = 0, r = *maxelement(a, a+n); ll ans = 0; while(l <= r){ ll mid = (l+r)/2; if(check(a, n, m, mid)){ ans = mid; l = mid + 1; } else{ r = mid - 1; } } cout << ans; }
include <bits/stdc++.h>
using namespace std;
int main() { ios::syncwithstdio(false); cin.tie(nullptr);
}
include <bits/stdc++.h>
using namespace std;
define ll long long
define ld long double
define FOR(i,a,b) for(int i = a; i <= b; i++)
define FOD(i,b,a) for(int i = b; i >= a; i--)
define pii pair<int,int>
define X first
define Y second
define Name "CPHOTO"
struct Bo{ int id, l, r, x; }a[(int)1e5+5]; int f[(int)1e5+5];
void pull(int i){ a[a[i].l].r=a[i].r; a[a[i].r].l=a[i].l; a[i].l=0; a[i].r=0; }
void left(int i, int j){//i j a[i].r=j; a[i].l=a[j].l; a[a[j].l].r=i; a[j].l=i; }
void right(int i, int j){//j i a[i].l=j; a[i].r=a[j].r; a[a[j].r].l=i; a[j].r=i; }
int main(){ iosbase::syncwith_stdio(0); cin.tie(NULL); cout.tie(NULL);
// cout<<m<
// cout<<x<<' '<<i<<' '<<j<
// FOR(i,1,n)cout<<a[i].id<<": "<<a[i].l<< ' '<<a[i].r<
}
/* */
include<bits/stdc++.h>
define ll long long
define fr first
define sc second
using namespace std ;
ll a[1000006]; int main() { iosbase::syncwith_stdio(false); cin.tie(NULL); cout.tie(NULL); //freopen("HV.inp", "r", stdin); //freopen("HV.out", "w", stdout); ll n; cin >> n; ll ans = 0; for(int i = 0 ; i < n ;i++){ cin >> a[i]; } sort(a, a+n); for(int i = 0; i < n; i++){ ans = max(ans, a[i] * (n - i + 1)); } cout << ans; }
include<bits/stdc++.h>
define ll long long
using namespace std;
ll a[1000006]; int main(){ freopen("XEPGACH.INP", "r", stdin); freopen("XEPGACH.out", "w", stdout); ll n; cin >> n; for(int i = 0; i < n; i++){ cin >> a[i]; } ll h = 101, d = 1; sort(a, a+n, greater<int>()); for(int i = 1; i < n; i++){ h = min(a[i], a[i-1] - 1); if(h < 0){ break; } else{ d++; } } cout << d; }
http://hoxuanhuong.edu.vn/contest/ct67 http://hoxuanhuong.edu.vn/contest/ct126 http://hoxuanhuong.edu.vn/contest/ct112
include <bits/stdc++.h>
define ll long long
define sc second
define fr first
using namespace std; int mod = 1e9 + 7; int main() { freopen("SoDacBiet.inp", "r", stdin); freopen("SoDacBiet.out", "w", stdout); ll n, k; cin >> n >> k; ll mu = 1; //n^0 ll sum = 0; while(k){ int r = k %2; k /= 2; sum += r * mu; mu *= n; sum %= mod; mu %= mod; } cout << sum; }
Heading
include<bits/stdc++.h>
define ll long long
using namespace std; int mod=1e9+7; ll a, b; ll mu(ll a, ll b){ if(b==1) return a%mod; a=a%mod; ll tmp= mu(a, b/2)%mod; ll res=tmptmp%mod; if(b%2==0) return res; return ares%mod; } int main(){ cin>>a>>b; cout<<mu(a,b); }
❤
❤
❤
❤
❤
f
f
f
f
f
fff
v \
v
v
v
v
:)))
.