| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 37253 | Yusup01 | 별들과 삼각형 (IZhO11_triangle) | C++14 | 0 ms | 18084 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
