답안 #96045

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
96045 2019-02-05T12:43:11 Z MohamedAhmed0 Sticks (POI11_pat) C++14
36 / 100
148 ms 14300 KB
#include <bits/stdc++.h>

using namespace std;

const int MAXK = 55 ;
const int MAXN = 1e6+10 ;
int arr[MAXK][MAXN] , sz[MAXK];
int k ;

int readInt () {
	bool minus = false;
	int result = 0;
	char ch;
	ch = getchar();
	while (true) {
		if (ch == '-') break;
		if (ch >= '0' && ch <= '9') break;
		ch = getchar();
	}
	if (ch == '-') minus = true; else result = ch-'0';
	while (true) {
		ch = getchar();
		if (ch < '0' || ch > '9') break;
		result = result*10 + (ch - '0');
	}
	if (minus)
		return -result;
	else
		return result;
}

bool is_triangle(int x , int y , int z)
{
    return (x < y+z && y < x + z && z < x+y) ;
}

int main()
{
    int n ;
    n = readInt();
    for(int i = 0 ; i < n ; ++i)
    {
        sz[i] = readInt();
        for(int j = 0 ; j < sz[i] ; ++j)
            arr[i][j] = readInt();
        sort(arr[i] , arr[i] + sz[i]) ;
    }
    for(int i = 0 ; i < n ; ++i)
    {
        for(int i2 = 0 ; i2 < sz[i] ; ++i2)
        {
            int a = arr[i][i2] ;
            int l = -1e8 , m = 1e8 , cl = -1 , cm = -1;
            for(int j = i+1 ; j < n ; ++j)
            {
                int high = lower_bound(arr[j] , arr[j] + sz[j] , a) - arr[j] ;
                int low = high-1 ;
                if(high != sz[j])
                {
                    if(is_triangle(a , l,  arr[j][high]))
                        return cout<<i+1<<" "<<a<<" "<<cl+1<<" "<<l<<" "<<j+1<<" "<<arr[j][high]<<"\n" , 0 ;
                }
                if(low >= 0)
                {
                    if(is_triangle(a , m , arr[j][low]))
                        return cout<<i+1<<" "<<a<<" "<<cm+1<<" "<<m<<" "<<j+1<<" "<<arr[j][low]<<"\n" , 0 ;
                }
                if(high != sz[j])
                {
                    if(arr[j][high] >= a && arr[j][high] < m)
                        cm = j , m = arr[j][high] ;
                }
                if(low >= 0)
                {
                    if(arr[j][high] <= a && arr[j][low] > l)
                        cl = j , l = arr[j][low] ;
                }
            }
        }
    }
    return cout<<"NIE\n" , 0 ;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Oczekiwano NIE
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Oczekiwano NIE
2 Correct 6 ms 760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Oczekiwano NIE
2 Incorrect 9 ms 888 KB Expected integer, but "NIE" found
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 348 KB Oczekiwano NIE
2 Incorrect 20 ms 1528 KB Expected integer, but "NIE" found
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 720 KB Oczekiwano NIE
2 Incorrect 27 ms 2216 KB Integer 0 violates the range [1, 50]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 37 ms 1272 KB Expected EOF
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 75 ms 7204 KB Output is correct
2 Incorrect 48 ms 4472 KB Integer 0 violates the range [1, 50]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 7288 KB Output is correct
2 Incorrect 49 ms 4856 KB Integer 0 violates the range [1, 50]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 146 ms 14200 KB Output is correct
2 Incorrect 56 ms 5624 KB Integer 0 violates the range [1, 50]
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 148 ms 14300 KB Output is correct
2 Incorrect 116 ms 6500 KB Integer 0 violates the range [1, 50]
3 Halted 0 ms 0 KB -