제출 #416663

#제출 시각아이디문제언어결과실행 시간메모리
416663victoriad말 (IOI15_horses)C++14
컴파일 에러
0 ms0 KiB
#include <cmath> #include <cstdio> #include <iostream> #include <algorithm> #include <utility> #include <stack> #include <vector> #include <fstream> #include <map> using namespace std; int mod=1e9+7; vector<long long int>lista1; vector<int>lista2; vector<int>lista3; vector<double>lista4; int m; double lm; int init(int N, int X[], int Y[]) { lista1.resize(N); lista2.resize(N); lista3.resize(N); lista4.resize(N); for(int i=0;i<N;i++)lista2[i]=Y[i]; for(int i=0;i<N;i++)lista3[i]=X[i]; double j=0; double r2=0; int a=1; int o=0; for(int i=0;i<N;i++){ r2+=log10(X[i]); lista4[i]=r2; a%=mod; lista1[i]=(a*X[i])%mod; lista1[i]%=mod; a=lista1[i]; if(r2+log10(Y[i])>j){ j=r2+log10(Y[i]); o=i; } } lm=j; for(int i=0;i<N;i++)cout<<lista1[i]; m=((lista1[o]%mod)*Y[o])%mod; return m; } int updateX(int pos, int val) { double j=0; double r2=0; int a=1; int o=0; lista3[pos]=val; for(int i=0;i<lista1.size();i++){ r2+=log10(lista3[i]); lista4[i]=r2; a%=mod; lista1[i]=(a*lista3[i])%mod; lista1[i]%=mod; a=lista1[i]; if(r2+log10(lista2[i])>j){ j=r2+log10(lista2[i]); o=i; } } lm=j; m=((lista1[o]%mod)*lista2[o])%mod; return m; } int updateY(int pos, int val) { if(lm<lista4[pos]+log10(val)){ m=(lista1[pos]*val)%mod; } return m; } int main(){ ios::sync_with_stdio(false); cin.tie(NULL); int n,m,a,b,c; cin>>n; int x[n],y[n]; for(int i=0;i<n;i++)cin>>x[i]; for(int i=0;i<n;i++)cin>>y[i]; cout<<init(n,x,y)<<"\n"; cin>>m; while(m--){ cin>>a>>b>>c; if(a==2){ cout<<updateX(b,c)<<"\n"; } else{ cout<<updateY(b,c)<<"\n"; } } return 0; }

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

horses.cpp: In function 'int init(int, int*, int*)':
horses.cpp:37:13: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   37 |   a=lista1[i];
      |             ^
horses.cpp:45:26: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   45 |  m=((lista1[o]%mod)*Y[o])%mod;
      |    ~~~~~~~~~~~~~~~~~~~~~~^~~~
horses.cpp: In function 'int updateX(int, int)':
horses.cpp:55:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |  for(int i=0;i<lista1.size();i++){
      |              ~^~~~~~~~~~~~~~
horses.cpp:61:13: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   61 |   a=lista1[i];
      |             ^
horses.cpp:68:31: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   68 |  m=((lista1[o]%mod)*lista2[o])%mod;
      |    ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
horses.cpp: In function 'int updateY(int, int)':
horses.cpp:75:22: warning: conversion from '__gnu_cxx::__alloc_traits<std::allocator<long long int>, long long int>::value_type' {aka 'long long int'} to 'int' may change value [-Wconversion]
   75 |   m=(lista1[pos]*val)%mod;
      |     ~~~~~~~~~~~~~~~~~^~~~
horses.cpp: In function 'int main()':
horses.cpp:82:11: warning: declaration of 'm' shadows a global declaration [-Wshadow]
   82 |     int n,m,a,b,c;
      |           ^
horses.cpp:17:5: note: shadowed declaration is here
   17 | int m;
      |     ^
/usr/bin/ld: /tmp/ccLBHVFG.o: in function `main':
grader.c:(.text.startup+0x0): multiple definition of `main'; /tmp/ccuD3B2H.o:horses.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status