답안 #470545

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
470545 2021-09-04T08:01:42 Z tonychi123 Just Long Neckties (JOI20_ho_t1) C++17
0 / 100
1 ms 204 KB
#define cerr cout
// #pragma GCC optimize("Ofast")
// #pragma GCC target("avx,avx2,fma")
#pragma GCC optimize ("Ofast")
#pragma GCC optimize ("unroll-loops")
// #pragma GCC target("avx,avx2,tune=native")
#include <bits/stdc++.h>

#define endl '\n'
#define all(v) begin(v), end(v)
#define ub upper_bound
#define lb lower_bound

// DBN is defined in /usr/local/Cellar/gcc/11.2.0/include/c++/11.2.0/x86_64-apple-darwin20/bits/stdc++.h
#ifndef tony 
#define DBN(...)
#define DBN1D(...) 
#define dbn(...)
#endif

template<typename T>
using Prior=std::priority_queue<T>;
template<typename T>
using prior=std::priority_queue<T,std::vector<T>,std::greater<T>>;

using namespace std;
typedef long long loli;
typedef vector<loli> vl;
typedef vector<vl> vvl;
typedef pair<loli,loli> pll;
typedef pair<pll,pll> pllll;
typedef vector<pll> vpll;
typedef long double ld;
typedef vector<ld> vld;
typedef vector<bool> vb;

void solve(){
    int n;
    cin>>n;
    vl nek(n+1),emp(n);
    for(auto&x:nek)
        cin>>x;
    for(auto&x:emp)
        cin>>x;
    sort(all(emp));
    multimap<loli,int> mp;
    for(int i=0;i<n+1;++i)
        mp.insert({nek[i],i});
    DBN1D(mp);
    sort(all(nek));
    for(auto p:mp){
        loli tmp=0;;
        dbn(p)
        bool flag=false;
        for(int i=0;i<n+1;++i){
            if(!flag && nek[i]==p.first){
                flag=true;
                continue;
            }
            dbn(nek[i],emp[i-flag]);
            tmp=max(tmp,max(nek[i]-emp[i-flag],0LL));
        }
        dbn(tmp);
        cout<<tmp<<' ';
    }
    dbn(*mp.begin());
    // cout<<ans<<endl;
}

int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);
    int _=1;
    // cin>>_;
    vl __(_);
    iota(all(__),1);
    for(auto i:__){
        #ifndef tony
        // cout<<"Case #"<<i<<": ";
        #endif
        solve();
        #ifdef tony
        // break;
        cerr<<"=================================================\n";
        #endif
    }
    return 0;
}

Compilation message

ho_t1.cpp: In function 'int main()':
ho_t1.cpp:76:14: warning: unused variable 'i' [-Wunused-variable]
   76 |     for(auto i:__){
      |              ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -