We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- C++
- Classes
- Exceptional Server
- Discussions
Exceptional Server
Exceptional Server
Sort by
recency
|
163 Discussions
|
Please Login in order to post a comment
}
i make this error :(
The test cases are wrong.
Running will test for this exception: Exception: vector::_M_range_check: __n (which is 969179) >= this->size() (which is 8144)
However, the real error is actually Exception: invalid vector subscript
include
include
include
include
include
include
using namespace std;
class Server { private: static int load; public: static int compute(long long A, long long B) { load += 1; if(A < 0) { throw std::invalid_argument("A is negative"); } vector v(A, 0); int real = -1, cmplx = sqrt(-1); if(B == 0) throw 0; real = (A/B)*real; int ans = v.at(B); return real + A - B*ans; } static int getLoad() { return load; } }; int Server::load = 0;
int main() { int T; cin >> T; while(T--) { long long A, B; cin >> A >> B;
<
}