int test() { vector<int> bigV; map<int, int> map; int N{ 0 }, M{ 0 }; scanf("%d %d", &N, &M); istringstream streamLine; for (int i = 0, nTemp = 0; i < N && scanf("%d", &nTemp) != EOF; ++i) { map[i] = nTemp; } if (map.size() != N) return -1; char c = 0; for (int i = 0, num1 = 0, num2 = 0; i < M; ++i) { scanf(" %c", &c); scanf("%d %d", &num1, &num2); if (c == 'U') { map[num1 - 1] = num2; } else if (c == 'Q') { if (num1 > num2) { int temp = num1; num1 = num2; num2 = temp; } int big = map[num1 - 1]; for (int i = num1; i < num2; i++) { if (big < map[i]) { big = map[i]; } } bigV.push_back(big); } } for (auto big : bigV) { printf("%d\n",big); } return 0; } 您的代码已保存 答案错误 case通过率为10.00% 用例: 9 10 28 49 11 35 40 17 57 4 6 Q 9 9 U 9 79 Q 9 5 Q 4 8 U 2 27 U 8 40 U 4 77 U 7 71 U 4 44 U 8 51 对应输出应该为: 6 79 57 你的输出为: 空 本地测试没问题,这里说答案错误,用例不通过。但是把这个“执行失败的”用例放在“代码自测”里面又是通过的。自相矛盾!

相关推荐

被加薪的哈里很优秀:应该继续招人,不会给你留岗位的
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务