Pagini recente » Borderou de evaluare (job #2347252) | Borderou de evaluare (job #2947956) | Borderou de evaluare (job #2627313) | Borderou de evaluare (job #2710751) | Borderou de evaluare (job #3003895)
Borderou de evaluare (job #3003895)
Raport evaluator
Compilare:
main.cpp: In function 'int main()':
main.cpp:2:643: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
2 | using namespace std;ifstream f("concurs.in");ofstream g("concurs.out");const int h=4e4;int p[h],a[h],b[h],t[h][16],n,m,x,y,r,c,d,q,s,u,i,j;vector<int> e[h];void z(int x){a[x]=++d;for(int y:e[x])z(y);b[x]=++d;}bool k(int x,int y){return(a[x]<=a[y]&&b[y]<=b[x]);}int o(int x,int y){if(k(x,y))return x;if(k(y,x))return y;for(i=15;i>0;i--)if(!k(t[x][i],y))x=t[x][i];return t[x][0];}int main(){f>>n>>m;for(i=1;i<=n;i++)f>>p[i];for(i=2;i<=n;i++){f>>x>>y;t[y][0]=x;e[x].push_back(y);}for(i=1;i<=n;i++)if(!t[i][0])r=i;for(j=1;j<16;j++)for(i=1;i<=n;i++){t[i][j]=t[t[i][j-1]][j-1];if(!t[i][j])t[i][j]=r;}z(r);while(m--){f>>x>>y;c=p[o(x,y)];if(q<c||q==c&&x<s||q==c&&x==s&&y<u)q=c,s=x,u=y;}g<<q<<' '<<s<<' '<<u;}
| ~~~~^~~~~
main.cpp:2:660: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
2 | using namespace std;ifstream f("concurs.in");ofstream g("concurs.out");const int h=4e4;int p[h],a[h],b[h],t[h][16],n,m,x,y,r,c,d,q,s,u,i,j;vector<int> e[h];void z(int x){a[x]=++d;for(int y:e[x])z(y);b[x]=++d;}bool k(int x,int y){return(a[x]<=a[y]&&b[y]<=b[x]);}int o(int x,int y){if(k(x,y))return x;if(k(y,x))return y;for(i=15;i>0;i--)if(!k(t[x][i],y))x=t[x][i];return t[x][0];}int main(){f>>n>>m;for(i=1;i<=n;i++)f>>p[i];for(i=2;i<=n;i++){f>>x>>y;t[y][0]=x;e[x].push_back(y);}for(i=1;i<=n;i++)if(!t[i][0])r=i;for(j=1;j<16;j++)for(i=1;i<=n;i++){t[i][j]=t[t[i][j-1]][j-1];if(!t[i][j])t[i][j]=r;}z(r);while(m--){f>>x>>y;c=p[o(x,y)];if(q<c||q==c&&x<s||q==c&&x==s&&y<u)q=c,s=x,u=y;}g<<q<<' '<<s<<' '<<u;}
| ~~~~~~~~~~^~~~~
Test |
Timp executie |
Memorie folosita |
Mesaj |
Punctaj/test |
1 | 0ms | 184kb | OK | 10 |
2 | 0ms | 184kb | Incorect | 0 |
3 | 0ms | 184kb | OK | 10 |
4 | 0ms | 184kb | OK | 10 |
5 | 0ms | 184kb | Incorect | 0 |
6 | 5ms | 2019kb | Incorect | 0 |
7 | 102ms | 5353kb | OK | 10 |
8 | 15ms | 3067kb | Incorect | 0 |
9 | 124ms | 3919kb | OK | 10 |
10 | 172ms | 4005kb | OK | 10 |
Punctaj total | 60 |