Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma GCC optimize("O3")
- #include <bits/stdc++.h>
- using namespace std;
- #define int long long
- #define double long double
- #define fastio ios_base::sync_with_stdio(0); cin.tie(0)
- signed main(){
- fastio;
- /*
- // A
- int t;
- cin >> t;
- while(t--){
- int n;
- cin >> n;
- int a[n + 5];
- for(int i = 0; i < n; i++){
- cin >> a[i];
- }
- sort(a , a + n);
- reverse(a , a + n);
- for(int i = 1; i < n; i++){
- if(a[i] != a[0]){
- cout << a[0] + a[i] << '\n';
- break;
- }
- }
- }
- */
- /*
- // B
- int t , n;
- cin >> t;
- while(t--){
- cin >> n;
- cout << (n + 1) / 7 << '\n';
- }
- */
- /*
- 1 2 3 4
- 4 1 2 3
- 3 4 1 2
- 2 3 4 1
- 1 4
- 4 3
- 3 2
- 1 2
- */
- /*
- // C
- int t;
- cin >> t;
- while(t--){
- int n;
- cin >> n;
- int a[n + 5];
- for(int i = 0; i < n; i++){
- cin >> a[i];
- }
- int ans = a[0] + a[n - 1];
- for(int i = 1; i < n; i++){
- ans = max(ans , a[i] + a[i - 1]);
- }
- cout << ans << '\n';
- }
- */
- /*
- int t , a , b;
- cin >> t;
- while(t--){
- cin >> a >> b;
- if(a >= b + 10){
- cout << 0 << '\n';
- continue;
- }
- int k = b + 10 - a;
- cout << (k + 2) / 3 << '\n';
- }
- */
- /*
- int t , x;
- cin >> t;
- while(t--){
- cin >> x;
- string s;
- cin >> s;
- int a = 0 , b = 0;
- for(char i : s){
- if(i == 'C')
- a++;
- if(i == 'N')
- b++;
- }
- if(a > b)
- cout << 60 * x << '\n';
- else if(a == b)
- cout << 55 * x << '\n';
- else
- cout << 40 * x << '\n';
- }
- */
- /*
- int a[3];
- for(int i = 0; i < 3; i++)
- cin >> a[i];
- sort(a , a + 3);
- if(a[0] + a[1] < a[2])
- cout << -1;
- else
- cout << a[2];
- */
- // 7 12
- // 1 12
- // 2 6
- // 3 4
- // 4 3
- // 6 2
- // 12 1
- /*
- int s , p;
- cin >> s >> p;
- for(int i = 1; i * i <= p; i++){
- if(p % i)
- continue;
- // p i-ye bolunur
- if(i + p / i == s){
- cout << "Yes";
- return 0;
- }
- }
- cout << "No";
- */
- /*
- int n;
- cin >> n;
- int a[n + 5] , p[n + 5];
- p[0] = 0;
- for(int i = 1; i <= n; i++){
- cin >> a[i];
- p[i] = p[i - 1] + a[i];
- // prefix sum
- }
- int b[n + 5] , s[n + 5];
- s[n + 1] = 0;
- for(int i = 1; i <= n; i++){
- cin >> b[i];
- }
- for(int i = n; i >= 1; i--){
- s[i] = s[i + 1] + b[i];
- }
- int ans = 0;
- for(int i = 1; i <= n; i++){
- ans = max(ans , p[i] + s[i]);
- }
- cout << ans << '\n';
- */
- // a: 3 2 2 4 1
- // p: 0 3 5 7 11 12
- // a: 1 2 2 2 1
- // s: 8 7 5 3 1 0
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement