답안 #899638

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
899638 2024-01-06T16:17:05 Z pcc Dijamant (COI16_dijament) C++14
27 / 100
158 ms 904 KB
#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,popcnt")

#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>
#define _all(T) T.begin(),T.end()


const int mxn = 1010;
vector<int> paths[mxn];
vector<string> in[mxn];
bitset<mxn> active;
int cnt[mxn];
bitset<mxn> up[mxn];
int n;
map<string,int> mp;

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>n;
	while(n--){
		string tmp;
		string now;
		cin>>now;
		vector<int> v;
		cin>>tmp;
		bool flag = true;
		while(cin>>tmp){
			if(tmp == ";")break;
			if(mp.find(tmp) == mp.end()){
				flag = false;
				continue;
			}
			v.push_back(mp[tmp]);
		}
		if(mp.find(now) != mp.end())flag = false;
		if(!flag){
			cout<<"greska\n";
			continue;
		}
		sort(v.begin(),v.end(),[](int a,int b){return cnt[a]>cnt[b];});
		for(int i = 1;i<v.size();i++){
			auto tmp = up[v[i]]&up[v[i-1]];
			if(tmp != up[v[i]]&&tmp.any())flag = false;
		}
		if(!flag){
			cout<<"greska\n";
			continue;
		}
		mp[now] = mp.size()+1;
		int tid = mp[now];
		up[tid][tid] = true;
		for(auto &i:v)up[tid]|=up[i];
		cnt[tid] = up[tid].count();
		cout<<"ok\n";
	}
	return 0;
}

Compilation message

dijament.cpp: In function 'int main()':
dijament.cpp:49:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |   for(int i = 1;i<v.size();i++){
      |                 ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 516 KB Output is correct
14 Correct 0 ms 600 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 344 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Incorrect 1 ms 348 KB Output isn't correct
22 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 135 ms 608 KB Output is correct
2 Correct 158 ms 904 KB Output is correct
3 Correct 66 ms 344 KB Output is correct
4 Incorrect 1 ms 344 KB Output isn't correct
5 Halted 0 ms 0 KB -