제출 #1369999

#제출 시각아이디문제언어결과실행 시간메모리
1369999eyadoozRelativnost (COCI15_relativnost)C++20
84 / 140
3759 ms40668 KiB
#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

#define pb push_back
#define all(x) (x).begin(), (x).end()
#define sz(x) (int) (x).size()
#define endl '\n'
#define mod 10007
#define int long long

const int N=(1ll<<17);
vector<int> tree[2*N];
vector<int> merg(vector<int>* a, vector<int>* b) {
    if(a->empty()) a->resize(22, 0), (*a)[0]=1;
    if(b->empty()) b->resize(22, 0), (*b)[0]=1;
    vector<int> ans;
    ans.resize(22, 0);
    // ans[0]=1;
    for(int i = 0;i <= 21;i++) {
        for(int j=0;j<= 21;j++) {
            ans[min(21ll, i+j)]+=((*a)[i]*(*b)[j])%mod;
            ans[min(21ll, i+j)]%=mod;
        }
    }
    return ans;
}
void update(int x, int y, int j) {
    x+=N;
    tree[x].resize(22, 0);
    tree[x][0]=j, tree[x][1]=y;
    while(x>1) {
        x/=2;
        tree[x]=merg(&tree[2*x], &tree[2*x+1]);
    }
}
main()
{
    cin.tie(0) -> sync_with_stdio(0);

    int n, c;
    cin >> n >> c;
    int a[n+1]={}, b[n+1]={};
    for(int i=1;i <= n;i++) cin >> a[i];
    for(int i=1;i <= n;i++) cin >> b[i];
    for(int i = 1;i <= n;i++) update(i, a[i]%mod, b[i]%mod);
    int q;
    cin >> q;
    while(q--) {
        int p;
        cin >> p;
        int x, y;
        cin >> x >> y;
        a[p]=x, b[p]=y;
        update(p, x, y);
        vector<int> s=tree[1];
        int ans=0;
        for(int i=c;i<=21;i++) ans+=s[i]%mod, ans%=mod;
        cout << ans << endl;
    }
}

컴파일 시 표준 에러 (stderr) 메시지

relativnost.cpp:40:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   40 | main()
      | ^~~~
#결과 실행 시간메모리채점기 출력
결과를 불러오는 중입니다…