제출 #222168

#제출 시각아이디문제언어결과실행 시간메모리
222168ryanseeTable Tennis (info1cup20_tabletennis)C++14
72 / 100
3095 ms263768 KiB
#include "bits/stdc++.h" using namespace std; #define FAST ios_base::sync_with_stdio(false); cin.tie(0); #define pb push_back #define eb emplace_back #define ins insert #define f first #define s second #define cbr cerr << "hi\n" #define mmst(x, v) memset((x), v, sizeof ((x))) #define siz(x) ll(x.size()) #define all(x) (x).begin(), (x).end() #define lbd(x,y) (lower_bound(all(x),y)-x.begin()) #define ubd(x,y) (upper_bound(all(x),y)-x.begin()) mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); //can be used by calling rng() or shuffle(A, A+n, rng) inline long long rand(long long x, long long y) { return (rng() % (y+1-x)) + x; } //inclusivesss string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?llabs(b):gcd(b%a,a); } typedef int ll; typedef long double ld; #define FOR(i,s,e) for(ll i=s;i<=ll(e);++i) #define DEC(i,s,e) for(ll i=s;i>=ll(e);--i) typedef pair<ll,ll>pi; typedef pair<ll,pi>spi; typedef pair<pi,pi>dpi; #define LLINF ((long long)1e18) #define INF int(1e9+1e6) #define MAXN (200006) ll n,k,A[MAXN]; bitset<MAXN> taken; unordered_map<ll,ll> mp; int main(){ FAST cin>>n>>k; n+=k; FOR(i,1,n)cin>>A[i],mp[A[i]]=i; auto tryy=[&](ll a,ll b){ taken.reset(); ll sum=A[a]+A[b]; taken[a]=taken[b]=1; ll co=2; FOR(i,a+1,b-1)if(!taken[i] && co<n-k){ if(mp[sum-A[i]]>i) { co+=2; taken[i]=taken[mp[sum-A[i]]]=1; } }else break; if(co==n-k)return 1; else return 0; }; vector<pi> v; FOR(i,1,k+1) DEC(j,n,n-k) if(i<=j && i-1+n-j<=k) v.eb(i,j); shuffle(all(v),rng); for(auto hmm:v) { ll i=hmm.f, j=hmm.s; if(tryy(i,j)){ FOR(i,1,n)if(taken[i])cout<<A[i]<<' '; cout<<'\n'; return 0; } } assert(0); }

컴파일 시 표준 에러 (stderr) 메시지

tabletennis.cpp: In function 'int main()':
tabletennis.cpp:22:20: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
 #define FOR(i,s,e) for(ll i=s;i<=ll(e);++i)
                    ^
tabletennis.cpp:57:4: note: in expansion of macro 'FOR'
    FOR(i,1,n)if(taken[i])cout<<A[i]<<' '; cout<<'\n';
    ^~~
tabletennis.cpp:57:43: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
    FOR(i,1,n)if(taken[i])cout<<A[i]<<' '; cout<<'\n';
                                           ^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...