제출 #1010511

#제출 시각아이디문제언어결과실행 시간메모리
1010511mychecksedadFish 3 (JOI24_fish3)C++17
0 / 100
2065 ms6388 KiB
/* Author : Mychecksdead */ #include<bits/stdc++.h> using namespace std; #define ll long long int #define MOD (1000000000+7) #define MOD1 (998244353) #define pb push_back #define all(x) x.begin(), x.end() #define en cout << '\n' const int N = 1e6+100, M = 1e5+10, K = 52, MX = 30; int n, q; ll D, C[N], b[N]; void solve(){ cin >> n >> D; for(int i = 1; i <= n; ++i) cin >> C[i]; cin >> q; for(int i = 1; i <= q; ++i){ int l, r; cin >> l >> r; int ans = 0; b[r] = C[r]; for(int x = r - 1; x >= l; --x){ if(C[x] <= b[x + 1]){ b[x] = C[x]; }else{ b[x] = C[x] % D; if(b[x] > b[x + 1]){ ans = -1; break; } ans += C[x] / D - (b[x + 1] - b[x]) / D; b[x] += (b[x + 1] - b[x]) / D * D; } } // for(int j = l; j <= r; ++j) cout << b[j] << ' '; cout << ans << '\n'; } } int main(){ cin.tie(0); ios::sync_with_stdio(0); int tt = 1, aa; // freopen("in.txt", "r", stdin); // freopen("out.txt", "w", stdout); while(tt--){ solve(); en; } cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" seconds\n"; return 0; }

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

Main.cpp: In function 'int main()':
Main.cpp:44:15: warning: unused variable 'aa' [-Wunused-variable]
   44 |   int tt = 1, aa;
      |               ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...