Submission #69421

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
694212018-08-20 20:03:09TadijaSebezLong Mansion (JOI17_long_mansion)C++11
25 / 100
269 ms192200 KiB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define mp make_pair
const int N=200050;
int pos[N],lo[N],hi[N],c[N],l[N],r[N];
vector<int> a[N];
bool on(int l, int r, int x){ return l<=x && r>=x;}
bool can(int l, int r, int x){ return (lo[x] && on(l,r,lo[x])) || (hi[x] && on(l,r,hi[x]));}
int main()
{
int n,q,i,j,x,y;
scanf("%i",&n);
for(i=1;i<n;i++) scanf("%i",&c[i]);
for(i=1;i<=n;i++)
{
scanf("%i",&x);
a[i].resize(x);
for(j=0;j<x;j++) scanf("%i",&a[i][j]);
}
for(i=1;i<=n;i++) pos[i]=0;
for(i=n;i>1;i--)
{
for(j=0;j<a[i].size();j++) pos[a[i][j]]=i;
hi[i-1]=pos[c[i-1]];
}
for(i=1;i<=n;i++) pos[i]=0;
for(i=1;i<n;i++)
{
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

long_mansion.cpp: In function 'int main()':
long_mansion.cpp:25:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(j=0;j<a[i].size();j++) pos[a[i][j]]=i;
           ~^~~~~~~~~~~~
long_mansion.cpp:31:12: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(j=0;j<a[i].size();j++) pos[a[i][j]]=i;
           ~^~~~~~~~~~~~
long_mansion.cpp:14:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%i",&n);
  ~~~~~^~~~~~~~~
long_mansion.cpp:15:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(i=1;i<n;i++) scanf("%i",&c[i]);
                   ~~~~~^~~~~~~~~~~~
long_mansion.cpp:18:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%i",&x);
   ~~~~~^~~~~~~~~
long_mansion.cpp:20:25: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   for(j=0;j<x;j++) scanf("%i",&a[i][j]);
                    ~~~~~^~~~~~~~~~~~~~~
long_mansion.cpp:51:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%i",&q);
  ~~~~~^~~~~~~~~
long_mansion.cpp:54:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%i %i",&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...