답안 #366206

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
366206 2021-02-13T13:40:53 Z Ahmad_Hasan Table Tennis (info1cup20_tabletennis) C++17
0 / 100
3000 ms 1048580 KB
#include <bits/stdc++.h>
#define int long long
/**
     ||||||||||       |||||     |||||    ||||||||||
    |||||||||||||     |||||     |||||  |||||
   ||||     ||||||    |||||     |||||  |||||
  |||||||||||||||||   |||||||||||||||    ||||||||||
 |||||||||||||||||||  |||||||||||||||           |||||
 |||||         |||||  |||||     |||||           |||||
 |||||         |||||  |||||     |||||    ||||||||||
AHMED;HASSAN;SAEED;
*/

using namespace std;

int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);      cout.tie(0);
    int n,k;
    cin>>n>>k;
    vector<int>v(n+k);

    int nn=n+k;
    for(int i=0;i<nn;i++){
        cin>>v[i];
    }

    map<int,int >mp,mp2;
    vector<vector<pair<int,int> > >pos((n)*(n));
    int cr=1;
    for(int i=0;i<nn&&i<n;i++){
        mp2[v[i]]=i+1;
        for(int j=nn-1;j>=0&&(nn-1-j)<=n;j--){
            if(!mp[v[i]+v[j]])mp[v[i]+v[j]]=cr++;
        }
    }
    int mxi=0;
    for(map<int,int>::iterator it=mp.begin();it!=mp.end();it++){
        for(int i=0;i<nn;i++){
            int vl=mp2[(it->first)-v[i]];
            if(vl>i+1){
                pos[it->second].push_back({i,vl-1});
            }

        }
    }
    for(int i=0;i<pos.size();i++)
        if(pos[i].size()>pos[mxi].size())
            mxi=i;
    vector<int>ans;
    for(int i=0;i<pos[mxi].size();i++){
        ans.push_back(v[pos[mxi][i].first]);
        ans.push_back(v[pos[mxi][i].second]);
    }

    sort(ans.begin(),ans.end());
    for(int i=0;i<ans.size();i++)
        cout<<ans[i]<<' ';

    return 0;
}
/**
4 3
100000000000 200000000000 300000000000 400000000000 800000000000 1000000000000 2000000000000

*/

Compilation message

tabletennis.cpp: In function 'int32_t main()':
tabletennis.cpp:48:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::vector<std::pair<long long int, long long int> > >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   48 |     for(int i=0;i<pos.size();i++)
      |                 ~^~~~~~~~~~~
tabletennis.cpp:52:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   52 |     for(int i=0;i<pos[mxi].size();i++){
      |                 ~^~~~~~~~~~~~~~~~
tabletennis.cpp:58:18: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   58 |     for(int i=0;i<ans.size();i++)
      |                 ~^~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 3093 ms 214004 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 556 ms 1048580 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 21 ms 3052 KB Execution killed with signal 6
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 60 ms 10872 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Incorrect 1 ms 364 KB Unexpected end of file - int32 expected
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 492 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 492 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 190 ms 23784 KB Unexpected end of file - int32 expected
2 Halted 0 ms 0 KB -