제출 #709682

#제출 시각아이디문제언어결과실행 시간메모리
709682Spade1Coins (IOI17_coins)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> //#include "grader.h" #define pii pair<int, int> #define pll pair<long long, long long> #define ll long long #define ld long double #define st first #define nd second #define pb push_back #define INF INT_MAX using namespace std; const int N = 1e5 + 10; const int M = 1e9+7; stack<int> s; ll h[N], w[N], qs[N]; ll power(ll a, ll b) { if (b == 0) return 1; ll ret = power(a, b/2); if (b&1) return ret*ret%M*a%M; else return ret*ret%M; } void solve() { int n; cin >> n; for (int i = 1; i <= n; ++i) cin >> h[i]; for (int i = 1; i <= n; ++i) cin >> w[i], qs[i] = qs[i-1]+w[i]; ll ans = 0; ll inv = power(2, M-2); s.push(0); for (int i = 1; i <= n; ++i) { while (h[s.top()] > h[i]) { ll H = h[s.top()]; H %= M; ll W = qs[i-1] - qs[s.top()-1]; W %= M; s.pop(); H -= h[s.top()]; ans += ((H)*(H+1)%M*inv%M * (W*(W+1)%M*inv)%M)%M; ans %= M; ans += (H*h[s.top()]%M * (W*(W+1)%M*inv)%M)%M; ans %= M; } s.push(i); } while (s.size() > 1) { ll H = h[s.top()]; H %= M; ll W = qs[n] - qs[s.top()-1]; W %= M; s.pop(); H -= h[s.top()]; ans += ((H)*(H+1)%M*inv%M * (W*(W+1)%M*inv)%M)%M; ans %= M; ans += (H*h[s.top()]%M * (W*(W+1)%M*inv)%M)%M; ans %= M; } cout << ans << '\n'; } int main() { ios_base::sync_with_stdio(0); cin.tie(NULL); int t = 1; // cin >> t; while (t--) { solve(); } return 0; }

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

/usr/bin/ld: /tmp/ccUxgWlK.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccL9uUXJ.o:coins.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccUxgWlK.o: in function `main':
grader.cpp:(.text.startup+0x3a5): undefined reference to `coin_flips(std::vector<int, std::allocator<int> >, int)'
/usr/bin/ld: grader.cpp:(.text.startup+0x997): undefined reference to `find_coin(std::vector<int, std::allocator<int> >)'
collect2: error: ld returned 1 exit status