QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#539523 | #8936. Team Arrangement | ucup-team112# | WA | 8ms | 5360kb | C++20 | 11.5kb | 2024-08-31 15:01:54 | 2024-08-31 15:01:54 |
Judging History
answer
//#define _GLIBCXX_DEBUG
//#pragma GCC target("avx2")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
#include<bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include <debug_print.hpp>
#define OUT(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__)
#else
#define OUT(...) (static_cast<void>(0))
#endif
#define endl '\n'
#define lfs cout<<fixed<<setprecision(15)
#define ALL(a) (a).begin(),(a).end()
#define ALLR(a) (a).rbegin(),(a).rend()
#define UNIQUE(a) (a).erase(unique((a).begin(),(a).end()),(a).end())
#define spa << " " <<
#define fi first
#define se second
#define MP make_pair
#define MT make_tuple
#define PB push_back
#define EB emplace_back
#define rep(i,n,m) for(ll i = (n); i < (ll)(m); i++)
#define rrep(i,n,m) for(ll i = (ll)(m) - 1; i >= (ll)(n); i--)
namespace template_tute{
using ll = long long;
using ld = long double;
const ll MOD1 = 1e9+7;
const ll MOD9 = 998244353;
const ll INF = 1e18;
using P = pair<ll, ll>;
template<typename T> using PQ = priority_queue<T>;
template<typename T> using QP = priority_queue<T,vector<T>,greater<T>>;
template<typename T1, typename T2>bool chmin(T1 &a,T2 b){if(a>b){a=b;return true;}else return false;}
template<typename T1, typename T2>bool chmax(T1 &a,T2 b){if(a<b){a=b;return true;}else return false;}
ll median(ll a,ll b, ll c){return a+b+c-max<ll>({a,b,c})-min<ll>({a,b,c});}
void ans1(bool x){if(x) cout<<"Yes"<<endl;else cout<<"No"<<endl;}
void ans2(bool x){if(x) cout<<"YES"<<endl;else cout<<"NO"<<endl;}
void ans3(bool x){if(x) cout<<"Yay!"<<endl;else cout<<":("<<endl;}
template<typename T1,typename T2>void ans(bool x,T1 y,T2 z){if(x)cout<<y<<endl;else cout<<z<<endl;}
template<typename T1,typename T2,typename T3>void anss(T1 x,T2 y,T3 z){ans(x!=y,x,z);};
template<typename T>void debug(const T &v,ll h,ll w,string sv=" "){for(ll i=0;i<h;i++){cout<<v[i][0];for(ll j=1;j<w;j++)cout<<sv<<v[i][j];cout<<endl;}};
template<typename T>void debug(const T &v,ll n,string sv=" "){if(n!=0)cout<<v[0];for(ll i=1;i<n;i++)cout<<sv<<v[i];cout<<endl;};
template<typename T>void debug(const vector<T>&v){debug(v,v.size());}
template<typename T>void debug(const vector<vector<T>>&v){for(auto &vv:v)debug(vv,vv.size());}
template<typename T>void debug(stack<T> st){while(!st.empty()){cout<<st.top()<<" ";st.pop();}cout<<endl;}
template<typename T>void debug(queue<T> st){while(!st.empty()){cout<<st.front()<<" ";st.pop();}cout<<endl;}
template<typename T>void debug(deque<T> st){while(!st.empty()){cout<<st.front()<<" ";st.pop_front();}cout<<endl;}
template<typename T>void debug(PQ<T> st){while(!st.empty()){cout<<st.top()<<" ";st.pop();}cout<<endl;}
template<typename T>void debug(QP<T> st){while(!st.empty()){cout<<st.top()<<" ";st.pop();}cout<<endl;}
template<typename T>void debug(const set<T>&v){for(auto z:v)cout<<z<<" ";cout<<endl;}
template<typename T>void debug(const multiset<T>&v){for(auto z:v)cout<<z<<" ";cout<<endl;}
template<typename T,size_t size>void debug(const array<T, size> &a){for(auto z:a)cout<<z<<" ";cout<<endl;}
template<typename T,typename V>void debug(const map<T,V>&v){for(auto z:v)cout<<"["<<z.first<<"]="<<z.second<<",";cout<<endl;}
template<typename T>vector<vector<T>>vec(ll x, ll y, T w){vector<vector<T>>v(x,vector<T>(y,w));return v;}
vector<ll>dx={1,-1,0,0,1,1,-1,-1};vector<ll>dy={0,0,1,-1,1,-1,1,-1};
template<typename T>vector<T> make_v(size_t a,T b){return vector<T>(a,b);}
template<typename... Ts>auto make_v(size_t a,Ts... ts){return vector<decltype(make_v(ts...))>(a,make_v(ts...));}
template<typename T1, typename T2>ostream &operator<<(ostream &os, const pair<T1, T2>&p){return os << "(" << p.first << "," << p.second << ")";}
template<typename T>ostream &operator<<(ostream &os, const vector<T> &v){os<<"[";for(auto &z:v)os << z << ",";os<<"]"; return os;}
template<typename T>void rearrange(vector<int>&ord, vector<T>&v){
auto tmp = v;
for(int i=0;i<tmp.size();i++)v[i] = tmp[ord[i]];
}
template<typename Head, typename... Tail>void rearrange(vector<int>&ord,Head&& head, Tail&&... tail){
rearrange(ord, head);
rearrange(ord, tail...);
}
template<typename T> vector<int> ascend(const vector<T>&v){
vector<int>ord(v.size());iota(ord.begin(),ord.end(),0);
sort(ord.begin(),ord.end(),[&](int i,int j){return make_pair(v[i],i)<make_pair(v[j],j);});
return ord;
}
template<typename T> vector<int> descend(const vector<T>&v){
vector<int>ord(v.size());iota(ord.begin(),ord.end(),0);
sort(ord.begin(),ord.end(),[&](int i,int j){return make_pair(v[i],-i)>make_pair(v[j],-j);});
return ord;
}
template<typename T> vector<T> inv_perm(const vector<T>&ord){
vector<T>inv(ord.size());
for(int i=0;i<ord.size();i++)inv[ord[i]] = i;
return inv;
}
ll FLOOR(ll n,ll div){assert(div>0);return n>=0?n/div:(n-div+1)/div;}
ll CEIL(ll n,ll div){assert(div>0);return n>=0?(n+div-1)/div:n/div;}
ll digitsum(ll n){ll ret=0;while(n){ret+=n%10;n/=10;}return ret;}
ll modulo(ll n,ll d){return (n%d+d)%d;};
template<typename T>T min(const vector<T>&v){return *min_element(v.begin(),v.end());}
template<typename T>T max(const vector<T>&v){return *max_element(v.begin(),v.end());}
template<typename T>T acc(const vector<T>&v){return accumulate(v.begin(),v.end(),T(0));};
template<typename T>T reverse(const T &v){return T(v.rbegin(),v.rend());};
//mt19937 mt(chrono::steady_clock::now().time_since_epoch().count());
int popcount(ll x){return __builtin_popcountll(x);};
int poplow(ll x){return __builtin_ctzll(x);};
int pophigh(ll x){return 63 - __builtin_clzll(x);};
template<typename T>T poll(queue<T> &q){auto ret=q.front();q.pop();return ret;};
template<typename T>T poll(priority_queue<T> &q){auto ret=q.top();q.pop();return ret;};
template<typename T>T poll(QP<T> &q){auto ret=q.top();q.pop();return ret;};
template<typename T>T poll(stack<T> &s){auto ret=s.top();s.pop();return ret;};
ll MULT(ll x,ll y){if(LLONG_MAX/x<=y)return LLONG_MAX;return x*y;}
ll POW2(ll x, ll k){ll ret=1,mul=x;while(k){if(mul==LLONG_MAX)return LLONG_MAX;if(k&1)ret=MULT(ret,mul);mul=MULT(mul,mul);k>>=1;}return ret;}
ll POW(ll x, ll k){ll ret=1;for(int i=0;i<k;i++){if(LLONG_MAX/x<=ret)return LLONG_MAX;ret*=x;}return ret;}
std::ostream &operator<<(std::ostream &dest, __int128_t value) {
std::ostream::sentry s(dest);
if (s) {
__uint128_t tmp = value < 0 ? -value : value;
char buffer[128];
char *d = std::end(buffer);
do {
--d;
*d = "0123456789"[tmp % 10];
tmp /= 10;
} while (tmp != 0);
if (value < 0) {
--d;
*d = '-';
}
int len = std::end(buffer) - d;
if (dest.rdbuf()->sputn(d, len) != len) {
dest.setstate(std::ios_base::badbit);
}
}
return dest;
}
namespace converter{
int dict[500];
const string lower="abcdefghijklmnopqrstuvwxyz";
const string upper="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
const string digit="0123456789";
const string digit1="123456789";
void regi_str(const string &t){
for(int i=0;i<t.size();i++){
dict[t[i]]=i;
}
}
void regi_int(const string &t){
for(int i=0;i<t.size();i++){
dict[i]=t[i];
}
}
vector<int>to_int(const string &s,const string &t){
regi_str(t);
vector<int>ret(s.size());
for(int i=0;i<s.size();i++){
ret[i]=dict[s[i]];
}
return ret;
}
vector<int>to_int(const string &s){
auto t=s;
sort(t.begin(),t.end());
t.erase(unique(t.begin(),t.end()),t.end());
return to_int(s,t);
}
vector<vector<int>>to_int(const vector<string>&s,const string &t){
regi_str(t);
vector<vector<int>>ret(s.size(),vector<int>(s[0].size()));
for(int i=0;i<s.size();i++){
for(int j=0;j<s[0].size();j++){
ret[i][j]=dict[s[i][j]];
}
}
return ret;
}
vector<vector<int>>to_int(const vector<string>&s){
string t;
for(int i=0;i<s.size();i++){
t+=s[i];
}
sort(t.begin(),t.end());t.erase(unique(t.begin(),t.end()),t.end());
return to_int(s,t);
}
string to_str(const vector<int>&s,const string &t){
regi_int(t);
string ret;
for(auto z:s)ret+=dict[z];
return ret;
}
vector<string> to_str(const vector<vector<int>>&s,const string &t){
regi_int(t);
vector<string>ret(s.size());
for(int i=0;i<s.size();i++){
for(auto z:s[i])ret[i]+=dict[z];
}
return ret;
}
}
template< typename T = int >
struct edge {
int to;
T cost;
int id;
edge():to(-1),id(-1){};
edge(int to, T cost = 1, int id = -1):to(to), cost(cost), id(id){}
operator int() const { return to; }
};
template<typename T>
using Graph = vector<vector<edge<T>>>;
template<typename T>
Graph<T>revgraph(const Graph<T> &g){
Graph<T>ret(g.size());
for(int i=0;i<g.size();i++){
for(auto e:g[i]){
int to = e.to;
e.to = i;
ret[to].push_back(e);
}
}
return ret;
}
template<typename T>
Graph<T> readGraph(int n,int m,int indexed=1,bool directed=false,bool weighted=false){
Graph<T> ret(n);
for(int es = 0; es < m; es++){
int u,v;
T w=1;
cin>>u>>v;u-=indexed,v-=indexed;
if(weighted)cin>>w;
ret[u].emplace_back(v,w,es);
if(!directed)ret[v].emplace_back(u,w,es);
}
return ret;
}
template<typename T>
Graph<T> readParent(int n,int indexed=1,bool directed=true){
Graph<T>ret(n);
for(int i=1;i<n;i++){
int p;cin>>p;
p-=indexed;
ret[p].emplace_back(i);
if(!directed)ret[i].emplace_back(p);
}
return ret;
}
}
using namespace template_tute;
template<typename T>
struct Sum2D{
vector<vector<T>>data;
ll h,w;
Sum2D(vector<vector<T>>&a):h(a.size()),w(a[0].size()){
data.assign(h+1,vector<T>(w+1,0));
for(ll i=0;i<h;i++)for(ll j=0;j<w;j++){
data[i+1][j+1]=a[i][j];
}
for(ll i=0;i<h;i++)for(ll j=0;j<w+1;j++)data[i+1][j]+=data[i][j];
for(ll i=0;i<h+1;i++)for(ll j=0;j<w;j++)data[i][j+1]+=data[i][j];
}
T query(ll x1,ll x2,ll y1, ll y2){
//if(x1>x2)swap(x1,x2);if(y1>y2)swap(y1,y2);
if(x1<0||x2>h||y1<0||y2>w||x1>=x2||y1>=y2)return 0;
else return data[x2][y2]-data[x2][y1]-data[x1][y2]+data[x1][y1];
}
};
void solve(){
ll res=0,buf=0;
bool judge = true;
ll n;cin>>n;
vector<ll>l(n),r(n);
rep(i,0,n)cin>>l[i]>>r[i];
vector<ll>pre(n+1),suf(n+1);
auto a=vec(n+2,n+2,0LL);
rep(i,0,n){
a[l[i]][r[i]]++;
}
//OUT(a);
Sum2D<ll>sum(a);
vector<ll>w(n+1);
rep(i,1,n+1)cin>>w[i];
ll sz=n+5;
auto dp=make_v(n+1,n+1,n+1,-INF);
//人数、ラスト、あまり
dp[0][0][0]=0;
rep(i,0,n+1){
rep(j,0,n){
rep(o,0,n+1){
rep(t,j,n+1){
if(i+t>n)continue;
if(dp[i][j][o]==-INF)continue;
ll no=max(o+sum.query(j+1,t,j+1,t),sum.query(0,t,0,t))+t;
if(no+sum.query(t+1,n+1,t+1,n+1)>n)continue;
chmax(dp[i+t][t][no],dp[i][j][o]+w[t]);
//OUT(i,i+t,j,o,t,no,dp[i+t][t][no]);
}
}
}
}
//OUT(dp);
//OUT(dp);
ll mx=-INF;
rep(i,0,n+1)rep(j,0,n+1)chmax(mx,dp[n][i][j]);
anss(mx,-INF,"impossible");
}
int main(){
cin.tie(nullptr);
ios_base::sync_with_stdio(false);
ll res=0,buf=0;
bool judge = true;
int T = 1;
//cin>>T;
while(T--){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3808kb
input:
3 2 3 1 2 2 2 4 5 100
output:
9
result:
ok single line: '9'
Test #2:
score: 0
Accepted
time: 0ms
memory: 3548kb
input:
3 1 3 3 3 2 3 1 1 100
output:
100
result:
ok single line: '100'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3568kb
input:
2 1 1 2 2 1 1
output:
impossible
result:
ok single line: 'impossible'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3556kb
input:
3 2 3 1 2 2 2 -100 -200 100000
output:
-300
result:
ok single line: '-300'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3632kb
input:
9 1 4 2 5 3 4 1 5 1 1 2 5 3 5 1 3 1 1 1 1 1 1 1 1 1 1 1
output:
6
result:
ok single line: '6'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3648kb
input:
14 3 3 1 2 2 3 2 3 2 3 1 1 2 3 1 3 3 3 1 3 1 3 1 2 2 3 1 3 -9807452 -9610069 4156341 2862447 6969109 -7245265 -2653530 -5655094 6467527 -6872459 3971784 7312155 9766298 -2719573
output:
-16558567
result:
ok single line: '-16558567'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3680kb
input:
14 1 2 1 4 2 3 3 5 4 5 2 5 2 4 2 4 1 2 3 4 1 5 2 4 1 1 4 5 -13763 -7354207 1096407 -9063321 -4824546 -6275546 1258145 -5272834 -8631107 3581157 2320771 -7714508 8446625 -6816167
output:
-2673021
result:
ok single line: '-2673021'
Test #8:
score: 0
Accepted
time: 0ms
memory: 3604kb
input:
14 2 3 4 4 1 7 3 6 3 4 1 1 1 4 4 7 3 7 1 7 2 3 6 6 1 1 3 6 2923142 1686477 640352 2848353 9202543 -4441381 4866381 -3610520 8124124 -1372894 1111310 -7538627 466143 9937961
output:
5939733
result:
ok single line: '5939733'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3596kb
input:
14 1 7 1 2 8 8 1 1 7 8 6 9 7 8 1 4 6 9 3 3 1 1 3 7 5 8 4 8 -7139089 6365816 -9893288 5936146 -2803918 -4961415 1495365 -2564851 -2630365 -8608883 5813455 -4005459 -8844054 6703783
output:
impossible
result:
ok single line: 'impossible'
Test #10:
score: 0
Accepted
time: 0ms
memory: 3808kb
input:
14 6 13 3 7 2 13 6 8 4 5 12 13 3 10 4 11 2 14 3 4 5 13 10 14 10 14 3 12 -8599727 -1496394 855072 -7439122 -5170228 8009298 -250221 5841035 2949765 7166358 -3516548 -6851737 8173765 -917122
output:
impossible
result:
ok single line: 'impossible'
Test #11:
score: 0
Accepted
time: 3ms
memory: 5208kb
input:
60 21 34 13 34 48 49 31 42 5 6 16 30 1 25 35 37 3 14 3 32 25 54 2 41 24 44 27 52 26 55 8 35 31 47 41 42 4 35 53 59 13 19 11 51 36 48 5 59 40 44 28 50 5 51 37 53 50 60 14 50 22 58 20 50 20 21 5 20 19 55 5 45 19 35 7 29 5 53 25 33 19 51 37 41 13 29 12 24 13 40 10 22 1 5 22 32 14 42 11 41 16 60 35 43 3...
output:
impossible
result:
ok single line: 'impossible'
Test #12:
score: 0
Accepted
time: 7ms
memory: 5300kb
input:
60 4 11 1 7 8 24 2 18 11 26 6 18 5 26 5 11 6 21 17 30 9 22 1 29 7 14 9 18 23 26 3 28 3 14 4 16 7 18 2 3 8 8 10 20 8 29 5 28 5 7 16 19 16 18 8 11 5 28 12 21 8 20 8 27 9 23 15 28 1 4 6 27 10 15 10 20 2 7 4 21 9 23 23 25 20 23 19 29 16 25 12 15 3 27 3 9 1 26 9 11 12 14 14 24 16 22 7 7 9 26 24 29 3 27 1...
output:
impossible
result:
ok single line: 'impossible'
Test #13:
score: 0
Accepted
time: 7ms
memory: 5188kb
input:
60 2 4 15 18 1 17 3 10 11 19 3 14 14 14 9 10 9 15 1 17 10 17 3 9 4 10 6 10 7 14 3 20 20 20 5 14 1 9 3 17 10 14 3 13 8 15 9 13 5 9 2 16 4 9 9 19 13 18 4 20 8 19 13 18 9 11 11 14 8 17 7 11 1 11 5 7 10 12 3 8 8 18 9 20 11 19 1 16 1 17 3 20 3 3 2 10 7 7 4 18 8 16 5 7 16 20 1 5 10 15 9 11 2 6 11 19 6 16 ...
output:
impossible
result:
ok single line: 'impossible'
Test #14:
score: 0
Accepted
time: 7ms
memory: 5188kb
input:
60 1 3 1 3 3 5 2 6 5 5 2 5 5 6 1 5 3 6 6 6 2 6 2 2 2 3 1 6 2 4 2 3 1 3 4 5 2 4 5 5 3 5 3 5 1 5 2 6 3 6 1 6 1 4 3 3 2 2 1 6 2 3 2 6 4 6 5 5 1 6 2 3 1 2 4 4 2 5 1 4 4 4 4 6 2 6 2 3 2 4 1 2 1 4 3 6 2 5 2 6 1 1 1 5 5 6 3 6 1 2 3 5 5 6 5 6 1 6 3 4 -9765941 -9284625 -9136963 -1872925 -9334679 -67293 96416...
output:
-87758107
result:
ok single line: '-87758107'
Test #15:
score: 0
Accepted
time: 3ms
memory: 5228kb
input:
60 1 1 1 4 2 2 3 4 1 2 1 2 1 4 2 3 1 4 1 2 4 4 1 3 2 4 2 2 2 3 2 4 1 4 3 4 1 2 3 3 2 3 1 1 2 4 2 4 2 4 1 2 1 2 3 3 3 4 2 3 1 3 2 4 1 2 1 3 1 2 3 4 2 2 2 4 1 3 1 1 2 4 2 3 2 3 4 4 1 2 1 4 1 2 2 4 2 3 4 4 2 4 3 4 3 4 1 1 2 3 3 4 2 4 2 3 3 4 2 2 -8959736 5094365 2567070 -9106790 9323252 -7495337 818129...
output:
67209846
result:
ok single line: '67209846'
Test #16:
score: 0
Accepted
time: 7ms
memory: 5296kb
input:
60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 ...
output:
154133500
result:
ok single line: '154133500'
Test #17:
score: 0
Accepted
time: 7ms
memory: 5300kb
input:
60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 ...
output:
281129340
result:
ok single line: '281129340'
Test #18:
score: 0
Accepted
time: 7ms
memory: 5188kb
input:
60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 ...
output:
191361510
result:
ok single line: '191361510'
Test #19:
score: 0
Accepted
time: 6ms
memory: 5232kb
input:
60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 ...
output:
-1693012
result:
ok single line: '-1693012'
Test #20:
score: 0
Accepted
time: 7ms
memory: 5360kb
input:
60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 ...
output:
-354498
result:
ok single line: '-354498'
Test #21:
score: 0
Accepted
time: 3ms
memory: 5160kb
input:
60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 ...
output:
178078620
result:
ok single line: '178078620'
Test #22:
score: 0
Accepted
time: 8ms
memory: 5300kb
input:
60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 60 1 ...
output:
267872880
result:
ok single line: '267872880'
Test #23:
score: 0
Accepted
time: 7ms
memory: 5236kb
input:
60 1 60 2 55 5 60 5 55 3 58 1 57 5 57 3 57 2 55 4 55 3 57 1 57 1 56 3 60 5 57 1 55 4 60 2 60 3 58 1 55 5 56 2 60 2 59 2 58 4 59 5 59 4 58 4 58 2 56 2 59 4 55 4 56 3 60 5 57 4 56 3 56 4 57 2 55 1 55 1 56 2 58 4 59 5 56 1 57 3 55 1 55 2 59 3 56 2 58 5 55 5 57 5 58 5 58 4 58 5 58 2 60 1 59 1 55 3 58 1 ...
output:
101249576
result:
ok single line: '101249576'
Test #24:
score: 0
Accepted
time: 7ms
memory: 5168kb
input:
60 4 57 2 57 3 56 5 52 2 59 9 50 4 60 7 52 3 57 4 56 7 59 1 52 8 59 7 53 1 50 4 56 9 52 6 54 5 53 3 55 7 52 2 56 4 57 1 54 2 51 8 58 7 50 8 52 4 53 4 50 3 52 2 51 7 58 9 59 2 54 3 56 8 53 8 59 1 55 4 58 4 56 5 50 4 57 3 50 3 56 3 59 2 50 10 52 10 53 8 60 8 50 4 51 6 55 3 54 3 51 10 53 1 58 6 54 8 54...
output:
84670208
result:
ok single line: '84670208'
Test #25:
score: 0
Accepted
time: 7ms
memory: 5232kb
input:
60 19 58 18 40 7 53 1 56 15 53 18 47 6 56 6 52 9 43 12 41 13 46 12 59 13 52 15 51 5 51 12 42 18 41 11 60 8 50 15 42 16 57 3 41 6 57 11 41 12 46 12 48 7 52 9 60 9 53 13 55 8 53 1 53 1 43 18 51 3 49 2 44 8 56 8 47 20 48 19 52 3 56 18 55 9 42 20 43 15 59 9 57 17 46 10 48 14 40 16 45 17 46 9 53 2 47 4 5...
output:
35924238
result:
ok single line: '35924238'
Test #26:
score: 0
Accepted
time: 3ms
memory: 5156kb
input:
60 8 44 25 53 22 41 14 38 9 40 8 36 4 44 13 52 12 55 19 40 16 55 4 55 22 51 12 57 16 45 11 48 18 55 11 35 13 39 8 52 20 42 15 47 2 57 15 36 9 48 23 52 5 60 20 56 4 35 14 44 1 57 8 46 3 53 12 55 21 44 14 60 17 47 3 57 10 58 1 43 2 39 4 43 19 51 10 48 19 56 17 45 22 36 14 58 9 52 20 58 3 41 2 38 3 36 ...
output:
39803807
result:
ok single line: '39803807'
Test #27:
score: 0
Accepted
time: 7ms
memory: 5156kb
input:
60 1 52 5 45 2 53 2 59 5 53 2 26 2 56 2 27 2 24 5 31 5 24 4 46 4 42 2 35 2 44 5 52 4 27 1 36 1 47 3 38 1 27 4 38 4 37 3 50 3 40 4 44 1 57 4 48 1 28 2 39 1 47 2 37 1 31 5 29 3 35 3 54 1 55 4 30 5 44 2 54 5 33 2 31 3 49 3 28 3 33 1 58 5 36 4 22 3 33 4 32 1 30 1 54 5 28 5 50 2 43 5 35 4 37 1 44 3 20 1 ...
output:
232766818
result:
ok single line: '232766818'
Test #28:
score: 0
Accepted
time: 3ms
memory: 5300kb
input:
60 1 41 1 28 2 24 1 33 3 55 5 32 5 26 3 31 1 22 1 43 3 27 1 36 5 45 1 55 1 22 2 24 4 26 3 52 2 58 2 32 3 59 3 46 4 33 5 59 5 42 2 46 3 49 4 40 5 40 4 21 3 45 5 47 5 42 5 44 2 56 4 29 5 52 3 43 5 23 1 49 4 38 2 20 4 31 1 49 2 24 3 48 5 52 2 36 3 44 4 48 5 44 4 34 4 47 1 51 5 47 3 23 3 40 5 38 5 52 1 ...
output:
-2774013
result:
ok single line: '-2774013'
Test #29:
score: 0
Accepted
time: 8ms
memory: 5160kb
input:
60 5 33 4 48 3 44 3 21 1 51 2 56 5 30 4 33 1 31 5 43 1 47 5 23 5 23 1 47 1 27 2 51 2 58 5 33 4 53 5 36 2 42 4 43 2 51 3 52 1 22 3 49 5 30 2 39 2 47 2 56 4 35 4 20 5 50 1 22 2 35 4 28 5 25 2 45 3 23 2 37 2 27 4 47 3 41 2 40 2 32 3 37 5 31 1 55 1 25 4 34 5 37 4 31 3 37 3 56 4 56 5 28 4 59 1 50 4 43 4 ...
output:
-3135271
result:
ok single line: '-3135271'
Test #30:
score: 0
Accepted
time: 7ms
memory: 5228kb
input:
60 4 52 2 58 4 33 1 39 5 59 1 52 3 44 5 57 5 54 4 46 4 36 3 42 1 50 1 37 3 20 4 24 3 48 2 58 1 33 5 47 2 27 3 24 4 37 3 57 2 52 2 56 3 45 2 24 4 35 3 23 2 21 4 52 4 44 4 54 3 51 2 49 1 46 5 49 2 25 5 58 5 44 4 42 5 23 5 57 3 38 4 60 1 46 2 36 5 48 2 40 5 28 4 45 3 35 3 50 4 25 3 27 5 55 3 57 3 51 2 ...
output:
193174547
result:
ok single line: '193174547'
Test #31:
score: 0
Accepted
time: 7ms
memory: 5232kb
input:
60 2 33 2 52 5 45 1 49 3 33 5 39 3 22 5 22 1 44 5 31 4 37 2 28 5 26 2 56 2 40 1 45 5 27 1 46 1 52 2 59 2 49 4 38 1 50 3 60 1 32 1 22 2 57 2 58 4 21 3 46 4 31 3 50 5 31 4 35 3 38 2 41 3 37 4 40 2 46 3 55 5 31 5 34 1 31 5 55 3 29 5 48 3 22 1 32 2 57 2 43 3 24 3 59 3 31 5 51 5 31 2 24 2 43 1 23 2 30 4 ...
output:
202290067
result:
ok single line: '202290067'
Test #32:
score: 0
Accepted
time: 3ms
memory: 5172kb
input:
60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 60 ...
output:
2785355
result:
ok single line: '2785355'
Test #33:
score: 0
Accepted
time: 6ms
memory: 5240kb
input:
60 48 53 6 7 47 50 2 12 47 55 45 53 49 53 47 52 46 54 45 50 46 51 47 52 47 52 47 52 49 54 48 52 49 54 49 55 50 52 2 11 46 55 4 12 46 52 45 53 50 53 46 55 2 8 4 9 3 8 50 55 46 55 48 52 50 55 45 54 50 55 5 9 50 50 48 53 50 55 3 7 45 55 48 53 49 53 45 51 46 55 50 52 48 53 49 55 48 51 48 54 45 55 47 52 ...
output:
6626637
result:
ok single line: '6626637'
Test #34:
score: 0
Accepted
time: 7ms
memory: 5300kb
input:
60 30 30 29 32 27 32 29 32 30 30 28 31 27 34 27 33 25 31 30 31 26 35 30 31 27 31 27 30 29 34 26 35 29 30 27 35 28 30 27 34 27 33 26 32 29 35 29 34 25 34 28 34 25 33 25 35 29 30 26 33 30 33 30 34 26 30 25 34 28 32 28 34 27 30 28 31 29 35 27 35 29 34 29 34 29 33 30 35 28 33 29 33 25 33 27 31 25 32 30 ...
output:
-1006632
result:
ok single line: '-1006632'
Test #35:
score: 0
Accepted
time: 3ms
memory: 5160kb
input:
60 26 34 30 34 26 31 30 33 25 32 30 32 27 32 25 30 30 31 25 33 28 31 28 33 30 33 28 35 25 34 29 34 30 30 30 35 25 35 28 35 26 31 26 35 28 31 26 34 25 34 29 31 25 31 28 33 27 34 27 33 26 32 29 34 29 30 30 30 27 32 30 31 28 33 28 30 27 33 25 32 27 30 25 34 28 30 26 33 29 32 29 34 26 34 28 33 26 32 25 ...
output:
-14968700
result:
ok single line: '-14968700'
Test #36:
score: 0
Accepted
time: 7ms
memory: 5176kb
input:
60 25 31 25 32 29 31 29 31 25 34 26 34 25 35 28 33 25 32 26 31 29 34 29 30 25 30 29 30 25 30 29 31 30 30 30 34 27 33 25 35 26 31 26 32 30 34 27 31 30 35 29 30 27 33 29 34 26 33 29 33 27 31 29 32 25 30 29 31 25 32 29 34 29 33 30 34 28 34 30 33 30 34 29 34 27 30 25 35 30 30 25 34 28 34 28 30 27 30 30 ...
output:
13397614
result:
ok single line: '13397614'
Test #37:
score: 0
Accepted
time: 6ms
memory: 5188kb
input:
60 19 23 20 20 16 25 20 24 20 22 19 23 19 20 20 21 18 20 16 20 15 25 15 24 17 21 16 25 20 25 19 20 19 25 16 25 19 23 18 21 18 24 19 23 19 20 18 25 18 23 16 20 17 24 17 23 17 23 19 23 19 20 17 22 17 20 20 25 18 20 18 24 18 23 18 25 16 22 17 23 19 20 20 25 16 23 16 25 17 25 17 20 20 25 16 23 18 23 17 ...
output:
21787020
result:
ok single line: '21787020'
Test #38:
score: 0
Accepted
time: 3ms
memory: 5236kb
input:
60 17 34 20 27 4 15 25 25 15 33 17 32 18 28 25 26 23 27 17 29 23 35 23 29 21 25 15 25 24 31 25 34 22 28 21 26 19 35 24 33 21 34 20 32 25 32 16 25 1 6 6 11 18 33 15 32 2 16 19 29 17 27 1 6 17 32 22 34 4 15 23 35 16 29 16 27 1 12 25 26 20 26 16 33 22 25 20 27 4 16 22 34 21 34 16 29 20 25 23 28 15 35 2...
output:
35420991
result:
ok single line: '35420991'
Test #39:
score: 0
Accepted
time: 6ms
memory: 5176kb
input:
60 11 20 14 16 12 15 10 14 13 16 14 17 11 14 11 17 14 16 12 15 10 17 13 19 5 9 10 18 15 19 9 15 8 11 10 13 10 17 9 14 7 12 9 13 11 16 7 15 7 12 7 11 9 14 12 17 6 11 9 13 10 18 13 18 8 10 9 14 8 12 9 13 12 14 7 12 7 15 4 14 11 15 14 19 12 16 10 11 8 14 11 15 4 14 8 13 12 16 12 15 10 16 9 15 13 17 14 ...
output:
11527150
result:
ok single line: '11527150'
Test #40:
score: 0
Accepted
time: 7ms
memory: 5296kb
input:
60 13 14 3 14 5 17 6 12 5 18 8 20 8 24 10 16 12 22 8 24 3 21 4 15 10 19 13 20 4 10 1 12 11 23 1 15 5 18 11 25 7 18 5 18 9 16 3 14 10 18 9 13 8 15 8 15 10 22 3 17 14 22 13 20 2 15 14 17 11 16 10 20 10 22 3 14 12 19 13 19 4 23 2 13 12 15 9 13 5 12 10 22 4 16 4 19 5 22 10 22 5 22 1 16 15 18 9 18 4 21 5...
output:
52962660
result:
ok single line: '52962660'
Test #41:
score: 0
Accepted
time: 3ms
memory: 5300kb
input:
60 7 7 7 8 9 10 7 9 8 9 7 9 6 7 6 7 10 10 7 7 9 11 10 11 7 9 9 10 9 11 8 9 10 10 10 11 10 10 9 10 10 10 10 11 10 10 7 9 10 10 10 11 7 7 10 11 9 11 6 8 10 10 8 9 8 9 7 7 8 9 9 10 7 7 8 9 7 8 6 7 10 10 7 8 8 8 9 11 10 10 9 10 6 7 10 11 7 9 6 7 7 8 9 10 10 11 10 11 9 10 9 11 7 9 8 8 6 7 9 11 9903784 75...
output:
7444173
result:
ok single line: '7444173'
Test #42:
score: 0
Accepted
time: 7ms
memory: 5156kb
input:
60 6 13 9 9 9 12 5 12 5 13 9 9 6 9 7 14 6 14 6 13 4 9 8 12 6 9 3 8 8 11 9 14 4 7 9 11 4 12 9 12 9 10 8 12 8 11 3 8 7 9 7 14 8 10 7 9 7 12 4 13 8 14 4 11 9 14 5 12 8 14 6 10 7 11 6 12 6 8 9 10 8 12 6 9 5 12 5 8 5 13 9 9 9 14 7 13 4 12 7 11 7 11 6 13 5 10 2 11 7 8 6 14 6 9 6 11 5 12 8 10 -7135770 -612...
output:
36399356
result:
ok single line: '36399356'
Test #43:
score: 0
Accepted
time: 7ms
memory: 5296kb
input:
60 9 15 6 12 4 11 4 15 6 15 3 16 6 18 6 17 2 18 4 18 6 12 2 18 9 14 1 10 1 10 8 16 4 16 3 19 4 13 6 15 6 18 5 17 10 19 1 11 4 16 4 19 6 19 6 19 1 17 2 14 7 17 2 15 6 11 4 13 5 10 3 20 6 15 2 17 2 14 8 12 10 20 3 17 5 9 4 13 8 19 2 18 1 15 7 18 9 9 6 10 1 4 2 17 5 12 6 8 2 16 3 12 9 14 6 15 8 13 2 14...
output:
108116159
result:
ok single line: '108116159'
Test #44:
score: 0
Accepted
time: 3ms
memory: 5228kb
input:
60 6 17 5 16 7 14 1 17 2 9 4 5 7 13 4 12 9 14 5 7 5 21 7 13 2 13 1 9 5 18 1 19 2 9 6 22 7 20 2 11 10 15 7 10 8 19 8 10 1 10 1 18 2 17 5 15 8 15 5 18 5 14 10 16 10 15 1 20 3 14 8 19 3 12 8 18 8 14 2 12 7 14 6 16 6 24 6 19 4 10 5 8 4 15 4 21 10 24 5 8 4 19 3 22 1 9 5 10 7 16 1 14 6 21 6 15 5 20 5 20 7...
output:
112278556
result:
ok single line: '112278556'
Test #45:
score: 0
Accepted
time: 7ms
memory: 5296kb
input:
60 2 13 8 21 8 29 3 11 2 10 1 15 4 24 1 24 3 6 7 16 5 29 2 15 3 26 6 19 7 17 10 14 4 20 9 9 7 10 10 19 5 24 8 23 4 16 5 16 6 12 4 26 2 29 8 22 2 15 4 11 8 29 4 20 8 22 4 14 1 17 8 11 9 18 4 15 10 30 9 25 10 21 7 14 9 14 2 26 6 13 3 18 5 18 8 16 9 9 6 29 2 16 10 14 1 24 3 27 1 10 6 14 2 25 5 10 4 15 ...
output:
42617774
result:
ok single line: '42617774'
Test #46:
score: 0
Accepted
time: 6ms
memory: 5144kb
input:
60 4 4 4 4 4 4 4 4 3 3 5 5 3 3 4 4 4 4 3 3 5 5 5 5 4 4 5 5 5 5 5 5 3 3 4 4 4 4 3 3 4 4 4 4 4 4 3 3 5 5 3 3 4 4 4 4 4 4 3 3 5 5 5 5 4 4 4 4 5 5 4 4 4 4 5 5 5 5 4 4 5 5 4 4 3 3 4 4 5 5 4 4 4 4 4 4 5 5 5 5 4 4 4 4 4 4 5 5 3 3 5 5 5 5 3 3 5 5 3 3 2902337 6482772 -92449 1451420 -7023253 8460311 -7289352 ...
output:
-18302868
result:
ok single line: '-18302868'
Test #47:
score: -100
Wrong Answer
time: 7ms
memory: 5176kb
input:
60 3 4 4 5 5 6 2 3 3 4 4 5 3 3 4 4 3 4 3 4 3 5 5 6 2 3 5 5 5 6 4 5 3 4 3 3 3 4 5 6 4 5 3 5 5 5 5 5 3 5 4 6 3 5 3 4 3 3 4 4 4 5 4 4 3 5 2 4 5 6 1 1 5 5 4 6 3 4 4 4 4 4 4 6 4 5 3 5 4 5 2 3 3 5 4 5 3 4 4 6 3 4 2 4 3 3 4 4 5 5 4 5 3 4 4 5 5 5 4 5 7873169 -2034482 -5068361 -5262215 -6149325 5383141 84508...
output:
-55539600
result:
wrong answer 1st lines differ - expected: '-55972594', found: '-55539600'