记录详情

Time Exceeded

/in/foo.cc: In function 'int main()':
/in/foo.cc:15:19: warning: suggest parentheses around comparison in operand of '^' [-Wparentheses]
             if (x > a ^ it->first) {
                 ~~^~~
# 状态 耗时 内存占用
#1 Wrong Answer 8ms 524.0 KiB
#2 Wrong Answer 8ms 520.0 KiB
#3 Time Exceeded ≥1000ms ≥1.117 MiB
#4 Time Exceeded ≥1002ms ≥1.109 MiB
#5 Time Exceeded ≥1001ms ≥1.121 MiB
#6 Time Exceeded ≥1000ms ≥1.117 MiB
#7 Time Exceeded ≥1003ms ≥1.109 MiB
#8 Time Exceeded ≥1001ms ≥1.113 MiB
#9 Time Exceeded ≥1001ms ≥1.117 MiB
#10 Time Exceeded ≥1000ms ≥1.109 MiB

代码

#include <iostream>
#include <unordered_map>
using namespace std;

int main() {
    int n;
    cin >> n;
    unordered_map<int, int> cnt;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int a;
        cin >> a;
        for (auto it = cnt.begin(); it!= cnt.end(); it++) {
            int x = a & it->first;
            if (x > a ^ it->first) {
                ans += it->second;
            }
        }
        cnt[a]++;
    }
    cout << ans << endl;
    return 0;
}

信息

递交者
类型
递交
题目
P1002 统计
语言
C++
递交时间
2024-09-10 19:26:02
评测时间
2024-09-10 19:26:02
评测机
分数
0
总耗时
≥8029ms
峰值内存
≥1.121 MiB