Submission #360166

#TimeUsernameProblemLanguageResultExecution timeMemory
360166nekiTenis (COCI20_tenis)C++14
0 / 110
1 ms364 KiB
#include <bits/stdc++.h> #define ll int #define loop(i, a, b) for(ll i=a;i<b;i++) #define pool(i, a, b) for(ll i=a-1;i>=b;i--) #define fore(i, a) for(auto&& i:a) #define fi first #define se second #define ps(a) push_back(a) #define pb(a) pop_back(a) #define sc scanf #define vc vector #define lb lower_bound #define ub upper_bound #define all(a) a.begin(), a.end() #define llmax LLONG_MAX/2 #define llmin -LLONG_MAX/2 using namespace std; #define mn 100100 #define par pair<ll, ll> #define ld long double #define mod 1000000007 ll per[mn][3], inv[mn][3]; ll cnt[9][3]; void create(ll ind, ll coc){ loop(i, 1, 9){ ll zmgpol=-1; loop(pol, 0, 3) if(i&(1<<pol) and (zmgpol==-1 or inv[ind][pol]<inv[ind][zmgpol])) zmgpol=pol; cnt[i][zmgpol]+=coc; } } ll vis[mn]; ll cntpol[3], cntpla[mn]; int main() { ll n;cin >> n; loop(pol, 0, 3){ loop(i, 0, n){ sc("%lld", &per[i][pol]);per[i][pol]--; inv[per[i][pol]][pol]=i; } } loop(i, 0, n) create(i, 1); ll ost=n; loop(i, 0, n){ map<ll, ll> sce; loop(pol, 0, 3) if(!vis[per[i][pol]])sce[per[i][pol]]+=(1<<pol); fore(v, sce) create(v.fi, -1), --ost, vis[v.fi]=1; fore(v, sce){ cntpla[v.fi]+=ost; loop(pol, 0, 3) cntpol[pol]+=cnt[v.se][pol]; } fore(v, sce) fore(u, sce) if(v.fi<u.fi){ ll kdo=-1, zmgpol=-1; loop(pol, 0, 3){ if(((1<<pol) & v.se) and (kdo==-1 or inv[u.fi][pol]<inv[kdo][zmgpol])) zmgpol=pol, kdo=u.fi; if(((1<<pol) & u.se) and (kdo==-1 or inv[v.fi][pol]<inv[kdo][zmgpol])) zmgpol=pol, kdo=v.fi; } //cout << v.fi <<u.fi << kdo<<endl; ++cntpol[zmgpol]; ++cntpla[(kdo==v.fi) ? u.fi:v.fi]; } } loop(i, 0, 3) cout << cntpol[i]<<" ";cout << endl; loop(i, 0, n) cout << cntpla[i]<<" ";cout<<endl; }

Compilation message (stderr)

tenis.cpp: In function 'int main()':
tenis.cpp:37:20: warning: format '%lld' expects argument of type 'long long int*', but argument 2 has type 'int*' [-Wformat=]
   37 |             sc("%lld", &per[i][pol]);per[i][pol]--;
      |                 ~~~^   ~~~~~~~~~~~~
      |                    |   |
      |                    |   int*
      |                    long long int*
      |                 %d
tenis.cpp:3:23: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
    3 | #define loop(i, a, b) for(ll i=a;i<b;i++)
      |                       ^~~
tenis.cpp:67:5: note: in expansion of macro 'loop'
   67 |     loop(i, 0, 3) cout << cntpol[i]<<" ";cout << endl;
      |     ^~~~
tenis.cpp:67:42: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   67 |     loop(i, 0, 3) cout << cntpol[i]<<" ";cout << endl;
      |                                          ^~~~
tenis.cpp:3:23: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
    3 | #define loop(i, a, b) for(ll i=a;i<b;i++)
      |                       ^~~
tenis.cpp:68:5: note: in expansion of macro 'loop'
   68 |     loop(i, 0, n) cout << cntpla[i]<<" ";cout<<endl;
      |     ^~~~
tenis.cpp:68:42: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   68 |     loop(i, 0, n) cout << cntpla[i]<<" ";cout<<endl;
      |                                          ^~~~
tenis.cpp:37:15: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   37 |             sc("%lld", &per[i][pol]);per[i][pol]--;
      |               ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...