답안 #68934

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
68934 2018-08-19T10:04:56 Z imsifile 초코쿠키 기계 (FXCUP3_chocolate) C++
100 / 100
1280 ms 29472 KB
#include<stdio.h>
#include<vector>
using namespace std;

int N, M, K, E, chk[301010], cnt[301010], rval, isok;
vector<int> con[301010], dap;

int main(){
	scanf("%d%d%d", &N, &M, &K);
	for(int i=0; i<M; i++){
		int a; scanf("%d", &a);
		chk[a]=1;
	}
	for(int i=0; i<K; i++){
		int a, b; scanf("%d%d", &a, &b);
		if(chk[a] || chk[b]) continue;
		con[a].push_back(b), con[b].push_back(a);
	}
	for(scanf("%d", &E); E--;){
		int a; char st[6];
		scanf("\nL + %d = %s", &a, &st);
		if(chk[a]) continue;
		if(st[0]=='O'){
			isok = 1;
			for(int i=0; i<con[a].size(); i++) cnt[con[a][i]]--;
		}
		else{
			rval++;
			for(int i=0; i<con[a].size(); i++) cnt[con[a][i]]++;
		}
	}
	for(int i=1; i<=N; i++){
		if(chk[i]){
			if(!isok) dap.push_back(i);
			continue;
		}
		if(cnt[i] == rval) dap.push_back(i);
	}
	printf("%d\n", dap.size());
	for(int i=0; i<dap.size(); i++){
		printf("%d", dap[i]);
		if(i < dap.size()-1) printf(" ");
		else printf("\n");
	}
	return 0;
}

Compilation message

chocolate.cpp: In function 'int main()':
chocolate.cpp:21:33: warning: format '%s' expects argument of type 'char*', but argument 3 has type 'char (*)[6]' [-Wformat=]
   scanf("\nL + %d = %s", &a, &st);
                              ~~~^
chocolate.cpp:25:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int i=0; i<con[a].size(); i++) cnt[con[a][i]]--;
                 ~^~~~~~~~~~~~~~
chocolate.cpp:29:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for(int i=0; i<con[a].size(); i++) cnt[con[a][i]]++;
                 ~^~~~~~~~~~~~~~
chocolate.cpp:39:27: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type {aka long unsigned int}' [-Wformat=]
  printf("%d\n", dap.size());
                 ~~~~~~~~~~^
chocolate.cpp:40:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0; i<dap.size(); i++){
               ~^~~~~~~~~~~
chocolate.cpp:42:8: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(i < dap.size()-1) printf(" ");
      ~~^~~~~~~~~~~~~~
chocolate.cpp:9: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:11:15: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int a; scanf("%d", &a);
          ~~~~~^~~~~~~~~~
chocolate.cpp:15:18: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   int a, b; scanf("%d%d", &a, &b);
             ~~~~~^~~~~~~~~~~~~~~~
chocolate.cpp:19:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for(scanf("%d", &E); E--;){
      ~~~~~^~~~~~~~~~
chocolate.cpp:21:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("\nL + %d = %s", &a, &st);
   ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 7380 KB Output is correct
2 Correct 13 ms 7400 KB Output is correct
3 Correct 12 ms 7584 KB Output is correct
4 Correct 143 ms 11552 KB Output is correct
5 Correct 10 ms 11552 KB Output is correct
6 Correct 9 ms 11552 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 692 ms 19132 KB Output is correct
2 Correct 84 ms 19132 KB Output is correct
3 Correct 245 ms 19132 KB Output is correct
4 Correct 954 ms 24296 KB Output is correct
5 Correct 252 ms 24296 KB Output is correct
6 Correct 59 ms 24296 KB Output is correct
7 Correct 1038 ms 25228 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 7380 KB Output is correct
2 Correct 13 ms 7400 KB Output is correct
3 Correct 12 ms 7584 KB Output is correct
4 Correct 143 ms 11552 KB Output is correct
5 Correct 10 ms 11552 KB Output is correct
6 Correct 9 ms 11552 KB Output is correct
7 Correct 692 ms 19132 KB Output is correct
8 Correct 84 ms 19132 KB Output is correct
9 Correct 245 ms 19132 KB Output is correct
10 Correct 954 ms 24296 KB Output is correct
11 Correct 252 ms 24296 KB Output is correct
12 Correct 59 ms 24296 KB Output is correct
13 Correct 1038 ms 25228 KB Output is correct
14 Correct 15 ms 25228 KB Output is correct
15 Correct 21 ms 25228 KB Output is correct
16 Correct 882 ms 25228 KB Output is correct
17 Correct 156 ms 25228 KB Output is correct
18 Correct 1088 ms 29472 KB Output is correct
19 Correct 1280 ms 29472 KB Output is correct
20 Correct 1088 ms 29472 KB Output is correct
21 Correct 927 ms 29472 KB Output is correct
22 Correct 1006 ms 29472 KB Output is correct
23 Correct 702 ms 29472 KB Output is correct