제출 #673571

#제출 시각아이디문제언어결과실행 시간메모리
673571WebbWayneIgra (COCI17_igra)C++17
0 / 100
1099 ms212 KiB
#include <iostream>
#include <bits/stdc++.h>

using namespace std;
#define rep(i, a, b) for(int i = a; i < b; i++)

bool checker(string temp, string word) {
	rep(i, 0, temp.size()) {
		if(temp[i] == word[i])
			return true;
	}

	return false;
}

int main() {
	int n;
	cin>>n;

	vector<char> letter(n);
	rep(i, 0, n) {
		cin>>letter[i];
	}

	string word;
	cin>>word;

	string temp = word;

	sort(temp.begin(), temp.end());

	do {
		next_permutation(temp.begin(), temp.end());
	}while(checker(temp, word));

	cout<<temp<<endl;

	return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

igra.cpp: In function 'bool checker(std::string, std::string)':
igra.cpp:5:39: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    5 | #define rep(i, a, b) for(int i = a; i < b; i++)
......
    8 |  rep(i, 0, temp.size()) {
      |      ~~~~~~~~~~~~~~~~~                 
igra.cpp:8:2: note: in expansion of macro 'rep'
    8 |  rep(i, 0, temp.size()) {
      |  ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...