QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#32407#3820. Antisocial networkmarquesluaTL 0ms0kbC++1.5kb2022-05-19 21:50:332022-05-19 21:50:34

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-05-19 21:50:34]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2022-05-19 21:50:33]
  • 提交

answer

#include <bits/stdc++.h>
#define pb push_back
#define mk make_pair
#define rep(i, a, b) for(int i = (int)a; i < (int)b; i++)
#define debug(a) cerr << #a << " = " << a << endl;
#define debug2(a, b) cerr << #a << " = " << a << " --- " << #b << " = " << b << endl;
#define debug3(a, b, c) cerr << #a << " = " << a << " --- " << #b << " = " << b << " --- " << #c << " = " << c << endl;
#define PI 3.1415926535897932384626433832795028841971
#define INF 0x3f3f3f3f
#define MAXV 1000006
#define MOD 1000000007
#define F first
#define S second
#define ms(a, b) memset(a, b, sizeof(a))
#define all(S) (S).begin(),(S).end()

using namespace std;

typedef long long int ll;
typedef pair<int, int> ii;

ll value[MAXV], sum[MAXV];
int aux[MAXV];
int main() {
  ios_base::sync_with_stdio(false);
	cin.tie(NULL);
  srand(time(NULL));
  int n, m, k;
  cin >> n >> m >> k;
  rep(i, 1, n+1)
  {
    rep(j, 0, 40)
    {
      int x = rand()%2;
      value[i] |= x*(1LL<<j);
    }
  }

  int a, b;
  while(m--)
  {
    cin >> a >> b;
    sum[a] ^= value[b];
    sum[b] ^= value[a];
  }

//  rep(i, 1, n+1)
//    debug3(i, value[i], sum[i])

  int s; 
  while(k--)
  {
    ll sumtot = 0;
    cin >> s;
    rep(i, 0, s)
    {
      cin >> aux[i];
      sumtot ^= value[aux[i]];
    }
    //debug(sumtot)

    rep(i, 0, s)
      sum[aux[i]] ^= (sumtot ^ value[aux[i]]);
  }

  rep(i, 1, n+1)
  {
    cout << (sum[i] ? "NIE" : "TAK") << endl;
    //debug(sum[i])
  }
  return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Time Limit Exceeded

input:

250000 200000 1746
212935 222993
209401 26644
194475 81010
35228 215397
18862 157757
2921 119716
75263 105477
120130 237099
135220 74270
74081 203661
199185 31171
17047 141501
209614 142989
118306 112566
189676 35913
199306 161761
173066 47468
44575 23683
98741 104427
65879 102354
3294 113844
91188 ...

output:

NIE
NIE
NIE
NIE
NIE
NIE
TAK
NIE
NIE
NIE
TAK
NIE
NIE
NIE
NIE
NIE
NIE
TAK
NIE
NIE
NIE
NIE
NIE
NIE
NIE
NIE
TAK
NIE
NIE
NIE
TAK
NIE
NIE
NIE
NIE
NIE
NIE
NIE
NIE
NIE
NIE
TAK
NIE
NIE
NIE
NIE
NIE
NIE
NIE
NIE
NIE
NIE
NIE
NIE
TAK
NIE
NIE
TAK
TAK
NIE
NIE
NIE
NIE
NIE
NIE
NIE
TAK
NIE
NIE
NIE
NIE
NIE
NIE
TAK
NIE
...

result: