답안 #40714

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
40714 2018-02-07T00:10:27 Z Hassoony Relativnost (COCI15_relativnost) C++14
0 / 140
3628 ms 23616 KB
#include <stdio.h>
#include <stdlib.h>
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef double D;
const ll inf=(1ll<<61);
const int mod=10007;
const int MX=1e5+9;
int n,c,a[MX],b[MX],tree[2*MX][21];
void update(int x){
    memset(tree[x],0,sizeof(tree[x]));
    for(int i=0;i<=c;i++){
        for(int j=0;j<=c;j++){
            int sz=i+j;sz=min(sz,c);
            tree[x][sz]=(tree[x][sz]+tree[x*2][i]*tree[x*2+1][j])%mod;
        }
    }
}
void update1(int x){
    x+=n;
    memset(tree[x],0,sizeof(tree[x]));
    tree[x][0]=b[x-n];
    tree[x][1]=a[x-n];
    for(x/=2;x>0;x/=2)update(x);
}
int main(){
    cin>>n>>c;
    for(int i=0;i<n;i++){
        scanf("%d",&a[i]);
        a[i]%=mod;
    }
    for(int i=0;i<n;i++){
        scanf("%d",&b[i]);
        b[i]%=mod;
    }
    for(int i=0;i<n;i++){
        tree[i+n][0]=b[i];
        tree[i+n][1]=a[i];
    }
    for(int i=0;i<n;i++)update(i);
    int q,i,l,r;
    scanf("%d",&q);
    while(q--){
        scanf("%d%d%d",&i,&l,&r);
        a[i-1]=l%mod;
        b[i-1]=r%mod;
        update1(i-1);
        printf("%d\n",tree[1][c]);
    }
}

Compilation message

relativnost.cpp: In function 'int main()':
relativnost.cpp:30:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&a[i]);
                          ^
relativnost.cpp:34:26: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&b[i]);
                          ^
relativnost.cpp:43:19: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&q);
                   ^
relativnost.cpp:45:33: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d%d",&i,&l,&r);
                                 ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 9 ms 504 KB Output isn't correct
2 Incorrect 14 ms 504 KB Output isn't correct
3 Incorrect 28 ms 552 KB Output isn't correct
4 Incorrect 473 ms 9736 KB Output isn't correct
5 Incorrect 1517 ms 17196 KB Output isn't correct
6 Incorrect 2310 ms 19876 KB Output isn't correct
7 Incorrect 997 ms 19876 KB Output isn't correct
8 Incorrect 529 ms 22480 KB Output isn't correct
9 Incorrect 954 ms 22480 KB Output isn't correct
10 Incorrect 3628 ms 23616 KB Output isn't correct