제출 #1305273

#제출 시각아이디문제언어결과실행 시간메모리
1305273bronze_coderSails (IOI07_sails)C++20
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin >> n; vector<long long> a; for(int i=0;i<n;i++){ int h,k; cin >> h >> k; while(a.size()<h){ a.push_back(0); } for(int i=0;i<k;i++){ a[h-1-i]++; } } while(true){ int z = 0; for(int i=0;i<a.size()-1;i++){ if(a[i]<a[i+1]){ x = a[i]+a[i+1]; a[i+1] = x/2; a[i] = x-x/2; z = 1; break; } } if(z==0){ break; } } long long ans = 0; for(int i:a){ ans += i*(i-1)/2; } cout << ans << endl; }

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

sails.cpp: In function 'int main()':
sails.cpp:23:17: error: 'x' was not declared in this scope
   23 |                 x = a[i]+a[i+1];
      |                 ^