답안 #72438

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
72438 2018-08-26T08:09:42 Z 이시대의진정한망겜스타투(#2267, cki86201, ainta) 초코쿠키 기계 (FXCUP3_chocolate) C++17
0 / 100
542 ms 19104 KB
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <memory.h>
#include <math.h>
#include <assert.h>
#include <queue>
#include <map>
#include <set>
#include <string>
#include <algorithm>
#include <iostream>
#include <functional>
#include <unordered_map>
#include <unordered_set>
#include <list>
#include <bitset>

using namespace std;
typedef long long ll;
#define Fi first
#define Se second
#define pb(x) push_back(x)
#define szz(x) ((int)(x).size())
#define rep(i, n) for(int i=0;i<n;i++)
#define all(x) (x).begin(), (x).end()
typedef tuple<int, int, int> t3;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ldouble;

int N, M, K;
int dang[300030];
vector <int> E[300030];
vector <int> X[2];
int cnt[300030];

int main() {
	scanf("%d%d%d", &N, &M, &K);
	for(int i=1;i<=M;i++) {
		int x; scanf("%d", &x);
		dang[x] = 1;
	}
	for(int i=1;i<=K;i++) {
		int x, y; scanf("%d%d", &x, &y);
		if(dang[x] || dang[y]) continue;
		E[x].pb(y);
		E[y].pb(x);
	}
	int only_boom = 1;
	int Q; scanf("%d", &Q);
	for(int i=1;i<=Q;i++) {
		int x;
		char buf[10];
		scanf(" L + %d = %s", &x, buf);
		if(buf[0] != 'B') only_boom = 0;
		if(buf[0] == 'B') {
			if(dang[x] == 0) X[0].pb(x);
		}
		else X[1].pb(x);
	}
	int gb = 0;
	for(int e : X[0]) for(int f : E[e]) cnt[f]++;
	for(int e : X[1]) {
		gb++;
		for(int f : E[e]) cnt[f]--;
	}
	for(int i=1;i<=N;i++) cnt[i] += gb;
	vector <int> v;
	for(int i=1;i<=N;i++) if(!dang[i] && cnt[i] == szz(X[0]) + szz(X[1])) v.pb(i);
	if(only_boom) for(int i=1;i<=N;i++) if(dang[i]) v.pb(i);
	printf("%d\n", szz(v));
	for(int e : v) printf("%d ", e); puts("");
	return 0;
}

Compilation message

chocolate.cpp: In function 'int main()':
chocolate.cpp:73:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
  for(int e : v) printf("%d ", e); puts("");
  ^~~
chocolate.cpp:73:35: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
  for(int e : v) printf("%d ", e); puts("");
                                   ^~~~
chocolate.cpp:39:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d%d", &N, &M, &K);
  ~~~~~^~~~~~~~~~~~~~~~~~~~~~
chocolate.cpp:41:15: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int x; scanf("%d", &x);
          ~~~~~^~~~~~~~~~
chocolate.cpp:45:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int x, y; scanf("%d%d", &x, &y);
             ~~~~~^~~~~~~~~~~~~~~~
chocolate.cpp:51:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  int Q; scanf("%d", &Q);
         ~~~~~^~~~~~~~~~
chocolate.cpp:55:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf(" L + %d = %s", &x, buf);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 7288 KB Output is correct
2 Correct 10 ms 7524 KB Output is correct
3 Correct 14 ms 7604 KB Output is correct
4 Correct 102 ms 11476 KB Output is correct
5 Correct 10 ms 11476 KB Output is correct
6 Incorrect 10 ms 11476 KB Output isn't correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 542 ms 19104 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 7288 KB Output is correct
2 Correct 10 ms 7524 KB Output is correct
3 Correct 14 ms 7604 KB Output is correct
4 Correct 102 ms 11476 KB Output is correct
5 Correct 10 ms 11476 KB Output is correct
6 Incorrect 10 ms 11476 KB Output isn't correct