Mai intai trebuie sa te autentifici.
Borderou de evaluare (job #3003884)
| Utilizator | Data | 15 martie 2023 23:38:22 | |
|---|---|---|---|
| Problema | Concurs | Status | done |
| Runda | Arhiva de probleme | Compilator | cpp-64 | Vezi sursa |
| Scor | 100 | ||
Raport evaluator
Compilare:
main.cpp: In function 'int main()':
main.cpp:2:644: 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:661: 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 | OK | 10 |
| 3 | 0ms | 184kb | OK | 10 |
| 4 | 0ms | 184kb | OK | 10 |
| 5 | 0ms | 184kb | OK | 10 |
| 6 | 3ms | 2019kb | OK | 10 |
| 7 | 105ms | 5431kb | OK | 10 |
| 8 | 13ms | 3067kb | OK | 10 |
| 9 | 122ms | 4009kb | OK | 10 |
| 10 | 178ms | 4009kb | OK | 10 |
| Punctaj total | 100 | |||
Ceva nu functioneaza?
- Citeste despre borderoul de evaluare.
- Daca tot nu e bine, contacteaza-ne pe forum !
