답안 #721294

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
721294 2023-04-10T16:00:56 Z vjudge1 Uzastopni (COCI17_uzastopni) C++17
48 / 80
103 ms 65536 KB
#include <bits/stdc++.h>

using namespace std;

using ll = long long;

int main()
{
    ios_base::sync_with_stdio(0); cin.tie(0);

    ll n; cin >> n;

    ll k = n;

    vector<ll> table(n+1);
    table[1] = 1;
    for(ll i = 2; i <= n-1; i++){
        if(table[i-1] == n){
           cout << 1 <<" "<< i-1 <<"\n";
        }
        table[i] = ((i*(i+1))/2);
    }
    ll pos = upper_bound(table.begin(), table.end(), n) - table.begin();



    for(ll i = pos; i <= n-1; i++){
        if(binary_search(table.begin(), table.end(), table[i]-n)){
            cout << lower_bound(table.begin(), table.end(), table[i]-n)-table.begin()+1 <<" "<< i <<"\n";
        }
    }


}

Compilation message

uzastopni.cpp: In function 'int main()':
uzastopni.cpp:13:8: warning: unused variable 'k' [-Wunused-variable]
   13 |     ll k = n;
      |        ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 5 ms 980 KB Output is correct
5 Correct 11 ms 1876 KB Output is correct
6 Correct 103 ms 15892 KB Output is correct
7 Runtime error 36 ms 65536 KB Execution killed with signal 9
8 Runtime error 38 ms 65536 KB Execution killed with signal 9
9 Runtime error 33 ms 65536 KB Execution killed with signal 9
10 Runtime error 2 ms 596 KB Execution killed with signal 6