Task: | Ositus |
Sender: | Anttono |
Submission time: | 2021-10-08 16:26:17 +0300 |
Language: | C++ (C++11) |
Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:33:9: error: 'cvr' was not declared in this scope cvr %= M; ^~~ input/code.cpp:33:9: note: suggested alternative: 'vr' cvr %= M; ^~~ vr
Code
#include <bits/stdc++.h> using namespace std; #define M 1000000007 typedef long long int ll; string s; ll r,vr; map<char,pair<ll,ll>> m; int main() { cin>>s; for(char c : s) { if(r == 0) { r++; } else { r *= 2; ll cvr = vr - m[c].second; cvr = cvr > 0 ? cvr : 0; cvr = m[c].first - cvr; cvr = cvr > 0 ? cvr : 0; r -= cvr; vr += cvr; } r %= M; cvr %= M; m[c] = make_pair(r,vr); } if(r<0) r += M; cout<<r; }