답안 #960168

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
960168 2024-04-09T19:14:36 Z hugsfromadicto Nadan (COCI18_nadan) C++14
15 / 50
1 ms 460 KB
#pragma GCC optimize("O3")
#include <bits/stdc++.h>
#define ll long long
#define OPT ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define pii pair<int,int>
#define fi first
#define se second
#define int long long
#define vi vector<int>
#define all(a) a.begin(),a.end()
#define pb push_back
#define MAX(a,b,c) max(a,max(b,c))
#define MIN(a,b,c) min(a,min(b,c))
using namespace std;
void USACO(string filename){
  freopen((filename+".in").c_str(),"r",stdin);
  freopen((filename+".out").c_str(),"w",stdout);
}

struct BIT
{
    int n;
    vector<int> ft;
    void init(int N)
    {
        n = N + 5;
        ft.assign(n + 5, 0);
    }
    void add(int pos, int val)
    {
        for (pos = pos + 1; pos <= n; pos += pos & -pos) ft[pos] += val;
    }
    int get(int pos, int res = 0)
    {
        for (pos = pos + 1; pos > 0; pos -= pos & -pos) res += ft[pos];
        return res;
    }
};
struct DSU
{
    int n;
    vector<int> e;
    void init(int N)
    {
        n = N;
        e.assign(n + 1, -1);
    }
    int get(int x)
    {
        if (e[x] < 0) return x;
        return e[x] = get(e[x]);
    }
    void unite(int x, int y)
    {
        x = get(x);
        y = get(y);
        if (x == y) return;
        if (e[x] > e[y]) swap(x, y);
        e[x] += e[y];
        e[y] = x;
    }
};

void _()
{
    int n,k;
    cin >> n >> k;
    int l = k - 1;
    int j = (l * (l + 1)) / 2;
    n -= j;
    int x = n / k;
    for(int i = 0; i < k; ++i)
        cout << x + i << endl;
}


main()
{
    OPT
    int tc = 1;
    while(tc--)
        _();
}

Compilation message

nadan.cpp:77:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   77 | main()
      | ^~~~
nadan.cpp: In function 'void USACO(std::string)':
nadan.cpp:16:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |   freopen((filename+".in").c_str(),"r",stdin);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
nadan.cpp:17:10: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |   freopen((filename+".out").c_str(),"w",stdout);
      |   ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Correct 0 ms 460 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Incorrect 0 ms 348 KB Output isn't correct
7 Incorrect 0 ms 348 KB Output isn't correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Incorrect 1 ms 348 KB Output isn't correct