답안 #1115781

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1115781 2024-11-21T00:16:22 Z staszic_ojuz Snake Escaping (JOI18_snake_escaping) C++17
5 / 100
2000 ms 4844 KB
#include <bits/stdc++.h>
using namespace std;
string bin(int n,int wielk){
	string napis;
	
	while(n>0){
		napis+=n%2+48;
		n/=2;
	}
	while(napis.size()!=wielk)
		napis+='0';
	reverse(napis.begin(),napis.end());
	
	return napis;
}
int main()
{
	ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int n,k;
	string napis,kolejne_snejki;
	cin >> n >> k >> napis;
	for(int i=0;i<k;++i){
		cin >> kolejne_snejki;
		int suma=0;
		for(int j=0;j<(1<<n);++j){
			string cos=bin(j,n);
			bool jest = true;
			for(int p=0;p<n;++p){
				if(cos[p]!=kolejne_snejki[p] && kolejne_snejki[p]!='?'){
					jest=false;
					break;
				}
					
			}
			if(jest==true){
				suma+=napis[j]-48;
			}
		}
		cout << suma << endl;
	}
	
	return 0;
}

Compilation message

snake_escaping.cpp: In function 'std::string bin(int, int)':
snake_escaping.cpp:10:20: warning: comparison of integer expressions of different signedness: 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   10 |  while(napis.size()!=wielk)
      |        ~~~~~~~~~~~~^~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 336 KB Output is correct
2 Correct 29 ms 336 KB Output is correct
3 Correct 40 ms 336 KB Output is correct
4 Correct 28 ms 336 KB Output is correct
5 Correct 29 ms 336 KB Output is correct
6 Correct 29 ms 336 KB Output is correct
7 Correct 29 ms 336 KB Output is correct
8 Correct 33 ms 336 KB Output is correct
9 Correct 31 ms 336 KB Output is correct
10 Correct 28 ms 336 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 336 KB Output is correct
2 Correct 29 ms 336 KB Output is correct
3 Correct 40 ms 336 KB Output is correct
4 Correct 28 ms 336 KB Output is correct
5 Correct 29 ms 336 KB Output is correct
6 Correct 29 ms 336 KB Output is correct
7 Correct 29 ms 336 KB Output is correct
8 Correct 33 ms 336 KB Output is correct
9 Correct 31 ms 336 KB Output is correct
10 Correct 28 ms 336 KB Output is correct
11 Execution timed out 2062 ms 1576 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 336 KB Output is correct
2 Correct 29 ms 336 KB Output is correct
3 Correct 40 ms 336 KB Output is correct
4 Correct 28 ms 336 KB Output is correct
5 Correct 29 ms 336 KB Output is correct
6 Correct 29 ms 336 KB Output is correct
7 Correct 29 ms 336 KB Output is correct
8 Correct 33 ms 336 KB Output is correct
9 Correct 31 ms 336 KB Output is correct
10 Correct 28 ms 336 KB Output is correct
11 Execution timed out 2062 ms 1576 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 336 KB Output is correct
2 Correct 29 ms 336 KB Output is correct
3 Correct 40 ms 336 KB Output is correct
4 Correct 28 ms 336 KB Output is correct
5 Correct 29 ms 336 KB Output is correct
6 Correct 29 ms 336 KB Output is correct
7 Correct 29 ms 336 KB Output is correct
8 Correct 33 ms 336 KB Output is correct
9 Correct 31 ms 336 KB Output is correct
10 Correct 28 ms 336 KB Output is correct
11 Execution timed out 2037 ms 4844 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 336 KB Output is correct
2 Correct 29 ms 336 KB Output is correct
3 Correct 40 ms 336 KB Output is correct
4 Correct 28 ms 336 KB Output is correct
5 Correct 29 ms 336 KB Output is correct
6 Correct 29 ms 336 KB Output is correct
7 Correct 29 ms 336 KB Output is correct
8 Correct 33 ms 336 KB Output is correct
9 Correct 31 ms 336 KB Output is correct
10 Correct 28 ms 336 KB Output is correct
11 Execution timed out 2062 ms 1576 KB Time limit exceeded
12 Halted 0 ms 0 KB -