Submission #929423

#TimeUsernameProblemLanguageResultExecution timeMemory
929423tamir1Adriatic (CEOI13_adriatic)C++14
25 / 100
2057 ms262144 KiB
#include<bits/stdc++.h> #define ll long long #define ff first #define ss second using namespace std; ll n,x,y,i,j,a,b,c,d,ans[250005],vis[250005]; pair<ll,ll> p[250005]; vector<ll> v[250005]; queue<pair<ll,ll>> q; int main(){ scanf("%d",&n); for(i=1;i<=n;i++){ scanf("%d%d",&x,&y); p[i]={x,y}; } for(i=1;i<=n;i++){ a=p[i].ff; b=p[i].ss; for(j=i+1;j<=n;j++){ c=p[j].ff; d=p[j].ss; if((a>c && b>d) || (a<c && b<d)){ v[i].push_back(j); v[j].push_back(i); } } } for(i=1;i<=n;i++){ vis[i]=i; q.push({i,0}); while(!q.empty()){ a=q.front().ff; b=q.front().ss; q.pop(); ans[i]+=b; for(j=0;j<v[a].size();j++){ c=v[a][j]; if(vis[c]<i){ vis[c]=i; q.push({c,b+1}); } } } } for(i=1;i<=n;i++) { printf("%lld\n",ans[i]); } }

Compilation message (stderr)

adriatic.cpp: In function 'int main()':
adriatic.cpp:11:10: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
   11 |  scanf("%d",&n);
      |         ~^  ~~
      |          |  |
      |          |  long long int*
      |          int*
      |         %lld
adriatic.cpp:13:11: warning: format '%d' expects argument of type 'int*', but argument 2 has type 'long long int*' [-Wformat=]
   13 |   scanf("%d%d",&x,&y);
      |          ~^    ~~
      |           |    |
      |           int* long long int*
      |          %lld
adriatic.cpp:13:13: warning: format '%d' expects argument of type 'int*', but argument 3 has type 'long long int*' [-Wformat=]
   13 |   scanf("%d%d",&x,&y);
      |            ~^     ~~
      |             |     |
      |             int*  long long int*
      |            %lld
adriatic.cpp:36:13: 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]
   36 |    for(j=0;j<v[a].size();j++){
      |            ~^~~~~~~~~~~~
adriatic.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |  scanf("%d",&n);
      |  ~~~~~^~~~~~~~~
adriatic.cpp:13:8: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |   scanf("%d%d",&x,&y);
      |   ~~~~~^~~~~~~~~~~~~~
#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...