답안 #743485

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
743485 2023-05-17T12:19:48 Z drkarlicio2107 Dijamant (COI16_dijament) C++14
27 / 100
402 ms 4712 KB
#include <bits/stdc++.h>
using namespace std;
map <string, int> m;
int ind=1;
vector <string> ev;
const int OFF=1010;
bitset <OFF> l [1010];
bitset <OFF> pom;
int ko [1010][1010];
vector < int > pom2;
int main(){
	int n; cin >> n;
	for (int i=0; i<n+1; i++){
		string s;
		getline (cin, s);
		ev.clear ();
		if (i==0) continue;
		string tre="";
		for (int j=0; j<s.size(); j++){
			if (s [j]==' '){
				if (tre!=":" && tre!=";") ev.push_back (tre);
				tre="";
			}
			else tre+=s [j];
		}
		if (m [ev [0]]){
			cout << "greska\n";
			continue;
		}
		int g=0; pom2.clear ();
		for (int j=1; j<ev.size(); j++){
			if (m [ev [j]]==0){
				l [ind]=0;
				cout << "greska\n"; g=1;
				break;
			}
			pom2.push_back (m [ev [j]]);
			l [ind]=(l [ind] | l [m [ev [j]]]);
			l [ind][m [ev [j]]]=1;
		}
		if (g) continue;
		pom=0; int br=1;
		sort (pom2.begin(), pom2.end()); reverse (pom2.begin(), pom2.end());
		if (pom2.size()>0) pom=l [pom2 [0]];
		for (int j=1; j<pom2.size(); j++){
			int x=pom2 [j];
			if (pom [x]==1) continue;
			//cout << l [x] << '\n';
			pom = (pom & l [x]); br++;
		}
		if (pom!=0 && br>1){
			cout << "greska\n";
			l [ind]=0;
			continue;
		}
		cout << "ok\n";
		m [ev [0]]=ind; ind++;
		//cout << ind << " " << l [ind] << endl;
	}
}

Compilation message

dijament.cpp: In function 'int main()':
dijament.cpp:19:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |   for (int j=0; j<s.size(); j++){
      |                 ~^~~~~~~~~
dijament.cpp:31:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::__cxx11::basic_string<char> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |   for (int j=1; j<ev.size(); j++){
      |                 ~^~~~~~~~~~
dijament.cpp:45:18: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   45 |   for (int j=1; j<pom2.size(); j++){
      |                 ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 264 KB Output is correct
6 Correct 4 ms 324 KB Output is correct
7 Correct 3 ms 340 KB Output is correct
8 Correct 1 ms 308 KB Output is correct
9 Correct 1 ms 304 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 264 KB Output is correct
6 Correct 4 ms 324 KB Output is correct
7 Correct 3 ms 340 KB Output is correct
8 Correct 1 ms 308 KB Output is correct
9 Correct 1 ms 304 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Incorrect 1 ms 212 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 349 ms 4224 KB Output is correct
2 Correct 402 ms 4712 KB Output is correct
3 Correct 145 ms 4496 KB Output is correct
4 Incorrect 3 ms 340 KB Output isn't correct
5 Halted 0 ms 0 KB -