답안 #1097890

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1097890 2024-10-08T14:22:27 Z s_mtOJ Potatoes and fertilizers (LMIO19_bulves) C++17
100 / 100
293 ms 16992 KB
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
#define F first
#define S second
#define pb push_back
#define EB emplace_back
#define MP make_pair
#define all(o) (o).begin(), (o).end()
#define rall(o) (o).rbegin(), (o).rend()
#define mset(m,v) memset(m,v,sizeof(m))
#define fr(i,n) for(ll i=0;i<n;++i)
#define rep(i,a,b) for(ll i=a;i<=b;++i)
#define per(i,a,b) for(ll i=a;i>=b;i--)
#define amin(a,b) (a=min((a),(b)))
#define amax(a,b) (a=max((a),(b))) 
#define sz(x) (ll)(x).size()
typedef long long ll;         typedef long double ld;
typedef pair<ll,ll> ii;       typedef vector<ll> vi;
typedef vector<ii> vii;       typedef vector<vi> graph;
long long md=1e9+7;           long double EPS=1e-9;
const double Pi=3.1415926535897932384626433832795;
const int N=100100;
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
#define debarr(a,n) cout<<#a<<" : ";for(int i=0;i<n;i++) cerr<<a[i]<<" "; cerr<<endl;
#define Haan cout<<"YES\n";
#define Naah cout<<"NO\n";
#define debmat(mat,row,col) cout<<#mat<<" :\n";for(int i=0;i<row;i++) {for(int j=0;j<col;j++) cerr<<mat[i][j]<<" ";cerr<<endl;}
#define pr(...) dbs(#__VA_ARGS__, __VA_ARGS__)
template <class S, class T>ostream& operator <<(ostream& os, const pair<S, T>& p) {return os << "(" << p.first << ", " << p.second << ")";}
template <class T>istream& operator>>(istream &is, vector<T> &a){for (auto &it : a)is >>it;return is;}
template <class T>ostream& operator <<(ostream& os, const vector<T>& p) {os<< "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const unordered_map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const unordered_set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const set<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T>ostream& operator <<(ostream& os, const multiset<T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class S, class T>ostream& operator <<(ostream& os, const map<S, T>& p) {os << "[ "; for (auto& it : p) os << it << " "; return os << "]";}
template <class T> void dbs(string str, T t) {cerr << str << " : " << t << "\n";}
template <class T, class... S> void dbs(string str, T t, S... s) {int idx = str.find(','); cerr << str.substr(0, idx) << " : " << t << ","; dbs(str.substr(idx + 1), s...);}
template <class T> void prc(T a, T b) {cerr << "["; for (T i = a; i != b; ++i) {if (i != a) cerr << ", "; cerr << *i;} cerr << "]\n";}
ll binpowMD(ll b,ll p,ll mod){ll ans=1;b%=mod;for(;p;p>>=1){if(p&1)ans=ans*b%mod;b=b*b%mod;}return ans;}
ll binpow(ll b,ll p){ll ans=1;for(;p;p>>=1){if(p&1)ans=ans*b;b=b*b;}return ans;}
ll fact[2*N],ifact[2*N];
void factorials(){
fact[0]=fact[1]=1;
for(int i=1;++i<2*N;)fact[i]=fact[i-1]*i%md;
ifact[2*N-1]=binpowMD(fact[2*N-1],md-2,md);
for(int i=2*N;--i>0;)ifact[i-1]=ifact[i]*i%md;
}

ll nCr(ll n,ll r){
if(n<r) return 0;
return  ((fact[n])*(ifact[n-r]*ifact[r]%md))%md;
}

void precompute(){
return;
factorials();
}

void testCases(){
   int n;
   cin>>n;
   vector<ll> pre(n+1,0);
   for(int i=1;i<=n;i++)
   {
    int a,b;
    cin>>a>>b;
    pre[i]+=pre[i-1]+(a-b);
   }
   priority_queue<ll> pq;
   ll ans=0;

   for(int i=0;i<=n;i++)
   {
      ll &x=pre[i];
      pq.push(x);
      ans+=abs(x);
      if(pq.empty()==false && x<pq.top())
      {
        pq.push(x);
        pq.pop();
      }
   }


   while(pq.empty()==false && pq.top()>0)
   {
    ans-=min(pq.top(),pre[n]);
    pq.pop();
   }

   cout<<ans<<"\n";

}

signed main(){
// ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
// #ifndef ONLINE_JUDGE
// freopen("in.txt", "r", stdin);
// freopen("output.txt", "w", stdout);
// freopen("output.txt", "w", stderr);
// #endif
// precompute();
ll _t=1;
// cin>>_t;
for(ll i=1;i<=_t;i++){
    //cout<<"Case #"<<i<<": ";
      testCases();
}
}
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣀⣀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣤⣾⣿⣿⣿⣿⣷⣦⣄⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀  ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀   ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀   ⣼⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣠⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣤⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣄⠀⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⢀⣴⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⢰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡀⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⠀⢼⣿⣿⣿⣿⣿⣿⣿⣿   ⣸⡄⠀  ⠤⠤⠤⠤⠤⠤⠤⠄   ⠀⣷⡀  ⣿⣿⣿⣿⣿⣿⣿⣿⣿⡆⠀⠀
// ⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿   ⡇⢧⠀⠀⠤⠤⠤⠤⠤⠤⠤⠄   ⢰⠋⡇  ⢸⣿⣿⣿⣿⣿⣿⣿⣿⣧⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿   ⡇⠈⢦⠀⠤⠤⠤⠤⠤⠤⠤⠄ ⣠⠃⢰⠇  ⢸⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀
// ⠀⠀⠀⠀⠀⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿   ⠘⣄⠀⠙⠤⣄⡀⠀⠀⠀⣀⡤⠚⠁⢠⠎    ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡀⠀⠀⠀
// ⠀⠀⠀⠀⢀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿    ⠈⠑⠢⠤⠔⠋⠁⠀⠙⠒⠤⠴⠚⠁     ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣇⠀⠀⠀
//      ⣿⣿⣿⣿⣿⣿⣿⣿⣵⣿⣿⣟⣛⣛⣿⣿⣿⣿⣿⣿⣿⣿⣿⣾⣿⣿⣿⣻⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀
//      ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣏⣯⣿⣽⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⢿⣿⣿⣿⣿⣿⣿⣿ ⠀⠀
//      ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⢸⣿⣿⣿⣿⣿⣿⣿⠀⠀
// ⠀   ⣿⣿⣿⣿⣿⣿⣿⣿⠿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿  ⣿⣿⣿⣿⣿⣿⣿ 
// ⠀  ⠀⣿⣿⣿⣿⣿⣿⣿⡏⠀⣸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣻⣿⢿⣿⣿⣿⣿⣿⣿  ⣿⣿⣿⣿⣿⣿⡿⠀
// ⠀    ⣿⣿⣿⣿⣿⣿⣷  ⣿⣿⣿⣿⣿⣿⡿⣿⣿⢿⡿⡿⢿⣯⢻⡼⣷⢰⣿⣿⣿⣿⣿⣿⡇⠀⣿⣿⣿⣿⣿⣿⡗⠀
//       ⢹⣿⣿⣿⣿⣿   ⣿⣿⣯⣼⡛⣧⠻⢿⢸⡇⣿⣿⣿⣼⣧⣿⣮⣿⣿⣿⣿⣿⣿⣇⠀ ⣿⣿⣿⣿⣿⡧⠀
// ⠀⠀⠀⠀⠀⣠⣾⣿⣿⣿⣿   ⣿⣿⣿      ⠺⠂⠀⠀⠀⣷⠀⠀           ⣿⣿ ⢸⣿⣿⣿⣿⣿⠁
// ⣿⣶⣦⣤⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿  ⣿⠞⠃⣿⡇⣼⠏⠻⣿⢠⣞⣉⣿ ⣿⠟⠙⠃ ⣿⣿ ⣸⣿⣿⣿⣿⡟⠀⠀⠀⠀⠀⠀⠀
// ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿  ⣿⠀⠀⣿⡇⢻⣦⣴⣿⠘⣯⣉⣩⠀⣿⠀⠀  ⢸⣿⣿ ⣿⣿⣿⣿⣿⠁⠀⠀⠀⠀⠀⠀⠀
// ⣿⣿⣿⣿⣿⣿⣿⣿⣿⢉⣿⣿⠤⠤⠤⠤⠤⠤⠤                      ⣿⣷⣿⣿⣿⣿⣿⠛⠀⠀⠀⠘⣼
// ⣿⣿⣿⣿⣿⣿⣿⣿⣿⠸⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⣠⣼⣿
// ⣿⡛⢛⣿⣿⣿⣿⣿⣿⣶⣿⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣯⣿⣿⣿⣿⡿⠀⠀⠀⣸⣿⠏
// ⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠁⢀⣀⣼⣿⠟⠀
/*********************$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$************************/
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 504 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 18 ms 1800 KB Output is correct
5 Correct 34 ms 3008 KB Output is correct
6 Correct 133 ms 7868 KB Output is correct
7 Correct 236 ms 15296 KB Output is correct
8 Correct 212 ms 13272 KB Output is correct
9 Correct 194 ms 12640 KB Output is correct
10 Correct 121 ms 10436 KB Output is correct
11 Correct 123 ms 10432 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 504 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 18 ms 1800 KB Output is correct
5 Correct 34 ms 3008 KB Output is correct
6 Correct 133 ms 7868 KB Output is correct
7 Correct 236 ms 15296 KB Output is correct
8 Correct 212 ms 13272 KB Output is correct
9 Correct 194 ms 12640 KB Output is correct
10 Correct 121 ms 10436 KB Output is correct
11 Correct 123 ms 10432 KB Output is correct
12 Correct 82 ms 4044 KB Output is correct
13 Correct 166 ms 10936 KB Output is correct
14 Correct 238 ms 15340 KB Output is correct
15 Correct 213 ms 13248 KB Output is correct
16 Correct 228 ms 12780 KB Output is correct
17 Correct 103 ms 10436 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 504 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 504 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 2 ms 348 KB Output is correct
16 Correct 3 ms 344 KB Output is correct
17 Correct 1 ms 388 KB Output is correct
18 Correct 2 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 504 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 18 ms 1800 KB Output is correct
12 Correct 34 ms 3008 KB Output is correct
13 Correct 133 ms 7868 KB Output is correct
14 Correct 236 ms 15296 KB Output is correct
15 Correct 212 ms 13272 KB Output is correct
16 Correct 194 ms 12640 KB Output is correct
17 Correct 121 ms 10436 KB Output is correct
18 Correct 123 ms 10432 KB Output is correct
19 Correct 82 ms 4044 KB Output is correct
20 Correct 166 ms 10936 KB Output is correct
21 Correct 238 ms 15340 KB Output is correct
22 Correct 213 ms 13248 KB Output is correct
23 Correct 228 ms 12780 KB Output is correct
24 Correct 103 ms 10436 KB Output is correct
25 Correct 1 ms 344 KB Output is correct
26 Correct 2 ms 348 KB Output is correct
27 Correct 2 ms 348 KB Output is correct
28 Correct 2 ms 348 KB Output is correct
29 Correct 3 ms 344 KB Output is correct
30 Correct 1 ms 388 KB Output is correct
31 Correct 2 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 66 ms 4044 KB Output is correct
34 Correct 161 ms 11068 KB Output is correct
35 Correct 293 ms 15208 KB Output is correct
36 Correct 290 ms 14788 KB Output is correct
37 Correct 204 ms 13420 KB Output is correct
38 Correct 274 ms 15196 KB Output is correct
39 Correct 152 ms 13252 KB Output is correct
40 Correct 161 ms 10872 KB Output is correct
41 Correct 123 ms 10340 KB Output is correct
42 Correct 117 ms 10472 KB Output is correct
43 Correct 127 ms 10532 KB Output is correct
44 Correct 143 ms 10328 KB Output is correct
45 Correct 246 ms 16992 KB Output is correct
46 Correct 124 ms 10728 KB Output is correct
47 Correct 184 ms 10380 KB Output is correct