# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
37253 | 2017-12-23T05:59:25 Z | Yusup01 | Star triangles (IZhO11_triangle) | C++14 | 0 ms | 18084 KB |
#include<bits/stdc++.h> using namespace std; long long i,j,k,l,m,n,dp[1009][1009],a[1009][1009],x,y,x2,y2,jog,yok,as,s,c; int main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); freopen("triangle.in","r",stdin); freopen("triangle.out","w",stdout); cin>>n; for(int i=1; i<=n; i++){cin>>x>>y; a[x][y]=1; x2=max(x2,x); y2=max(y,y2);} for(int i=0; i<=x2; i++) { for(int j=0; j<=y2; j++) { if(a[i][j]==0) continue; yok=0; s=0; as=0; c=0; for(int k=i-1; k>=0; k--) { if(a[k][j]==0) break; else yok++; } for(int k=i+1; k<=x2; k++) { if(a[k][j]==0) break; else as++; } for(int k=j-1; k>=0; k--) { if(a[i][k]==0) break; else c++; } for(int k=j+1; k<=y2; k++) { if(a[i][k]==0) break; else s++; } jog+=(yok*c)+(yok*s)+(s*as)+(as*c); } } cout<<jog; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 0 ms | 18084 KB | Execution killed because of forbidden syscall [unknown syscall - gap in table] (292) |
2 | Halted | 0 ms | 0 KB | - |